commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: [digester] Grabbing data from sub-element attributes
Date Fri, 13 May 2011 23:32:01 GMT
Hi Christopher,
I suggest you following Rahul's suggestion, SetNestedPropertiesRule is
not efficient as a direct invocation.
Moreover, for foo/bar properties, there's a 3rd way to set them:

 d.addObjectCreate("entities/entity", Entity.class);

 d.addBeanPropertySetter("entities/entity/foo");
 d.addBeanPropertySetter("entities/entity/bar");

 d.addCallMethod("entities/entity/baz", "setBaz", 1);
 d.addCallParam("entities/entity/baz", 0, "id");

HTH,
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Sat, May 14, 2011 at 12:11 AM, Christopher Schultz
<chris@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Rahul,
>
> On 5/13/2011 5:53 PM, Rahul Akolkar wrote:
>> Yeah, and probably more than one way even with out of the box rules:
>>
>>   d.addObjectCreate("entities/entity", Entity.class);
>>   d.addCallMethod("entities/entity/foo", "setFoo", 0);
>>   d.addCallMethod("entities/entity/bar", "setBar", 0);
>>   d.addCallMethod("entities/entity/baz", "setBaz", 1);
>>   d.addCallParam("entities/entity/baz", 0, "id");
>
> Thanks for the tip... that might actually be somewhat simpler code than
> I have now. I'm using setNestedProperties and enumerating them because I
> need to re-name some of the properties. But, that requires that I
> enumerate all of them, even those I want to ignore, otherwise I'll get
> an error. If I use addCallMethod, the Digester will probably ignore
> anything for which there is no rule.
>
> Thanks,
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk3NrH4ACgkQ9CaO5/Lv0PASVwCfSEYMFGwDYuOj0fZvaFuDl+YD
> 9tkAoIOnGQk4ERImSnU7LVW501rYjYEF
> =7vJb
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message