"Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:

> > I thought, BeanUtils.populate() tries to copy every parameter to a
property.
> > So it enumerates the request parameters, not the properties. If the
> > enumeration of properties was necessary, it could be done by some sort
> > of configuration of the bean. So the bean would be able to change
> > its properties list during the runtime. This is not a big problem, since
> > we can use string keyed properties in cases where the names cannot be
> > determined during deployment.
> >
>
> It does iterate through the request parameters -- but ultimately, it needs
> to be able to decide whether a particular request parameter matches the
> name of a valid property or not.  And this needs to work whether or not
> the dynamic bean already has a value for that property.

The problem with dynamic properties is, what has the bean to know, whether
a property exists. In case of dynamic properties the bean can have
unlimited number of properties since the property can be dynmically created
when used.

If the bean has to return a final list of its properties, then we have to
decide, what the answers to the following questions will be:

a) where to decide, which properties exist? Configuration file? Interface
  the bean can implement?
b) is this list related to each bean instance or to its class?

My preferences were:

a) The bean has to implement an interface, which will return an array
of its property descriptors. The implemnetation could depend on a
configuration file. We could provide some helper classes.
(This would also allow other kinds of properties without touching
PropertyUtils).

b) If we will use an interface for a) then the bean itself could decide.
(But what about caching).


> Further, we cannot really change this (the public API
> signature) anyway.  One of the premises of Commons packages is that we
> will take special care to maintain backwards compatibility, and
> arbitrarily removing a public method doesn't count as maintaining :-).

Yes, you are right. But what could be done, is to change the semantics
of the method. It would not return an array of ALL properties, it would
only return an array of the normal and indexed ones (and perhaps the
mapped ones).

--
gR



Reply via email to