Re: [Simple-support] CycleStrategy and capturing id attributes
Brought to you by:
niallg
|
From: Dawid W. <daw...@gm...> - 2013-03-16 00:09:44
|
Answering myself having peeked at the code: yes, CycleStrategy (or
rather ReadGraph) consume identifiers. I've hacked around by passing a
custom VisitorStrategy delegating to CycleStrategy and cloning the id
attribute inside visitor's read callback to another, shadow attribute.
Works like a charm.
Dawid
On Sat, Mar 16, 2013 at 12:51 AM, Dawid Weiss <daw...@gm...> wrote:
> Hi Niall, everyone,
>
> This caught me by surprise. I use CycleStrategy to deserialize a graph
> of objects (some of which are backrefs to single declarations). So,
> something like this:
>
> <client id="foo">
> </client>
>
> <client id="bar">
> </client>
>
> I would like to capture Client's ID attribute if it was provided explicitly:
>
> public static class Client {
> @Attribute(required = false)
> public String id;
> }
>
> This doesn't seem to work though (always null). I could use two
> separate identifiers but this will be confusing to whoever is editing
> those files... Thoughts?
>
> Dawid
|