On Thu, 4 Apr 2002, Nicolas De Loof wrote:

> Date: Thu, 4 Apr 2002 16:40:57 +0200
> From: Nicolas De Loof <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Re: strust.taglib.bean proposal
>
> I didn't know about this cache mecanism and "multiple capital letters"
> constraints.
>
> For use in my JSP Tag to set parent tag Attribute (known value type:
> String), do you think
>
> PropertyUtils.setSimpleProperty(parentTag, arg, bodyContent)
>
> is a good replacement from the reflection code ? So it will re-use
> PropertyUtil cache and introspection mecanism.
>

I'd say that it would be (assuming that bodyContent has already been
converted to a String, and arg is the property name of one of the parent
tag property setters).

Craig


> >
> > BeanUtils and PropertyUtils actually do somewhat more than this:
> >
> > * Property setter names do *not* have to start with "set" -- bean
> >   developers can supply an additional BeanInfo class to define the
> >   get and set method names.  BeanUtils uses the standard introspection
> >   capabilities to do this lookup.
> >
> > * There are some special case rules for property names that start with
> >   multiple capital letters that the introspection code deals with.
> >
> > * Because the introspection is the expensive part, the results are cached.
> >   Therefore, BeanUtils will execute repeated property sets on the same
> >   bean class much faster than the above code, which does a
> >   getMethod() lookup every single time.
> >
> > * The BeanUtils version of the property setters (including the ones
> >   called in populate()) do automatic type conversion for you, while
> >   the PropertyUtils version of the property setters assumes you already
> >   have the right data type.
> >
> > * The library methods know how to deal with indexed and mapped setters
> >   as well as scalar properties.
> >
> > So, the above code (if included in the tag) would most likely be replaced
> > by a call to PropertyUtils.getProperty() to take advantage of what the
> > library can do.
> >
> > Craig
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to