Hi,
today I got the time to write some more code for BeanUtils2, so I
started to implement setIndexed().
Now, that I'm nearly done with it, there are two things that I'm unsure
how to handle.
1. out of bounds indices: If the user passes in an index that is out of
bounds, he will see a InvocationTargetException, that wraps an
ArrayOutOfBoundsException (if the indexed property is backed up by an
array). Can we live with that or should we implement some logic, that
checks if the index is available and if not throws the appropriate
exception? (this would also have to be applied to getIndexed)
2. wrong property names: If the user passes a property name, that
doesn't specify a property on the given bean, he will see a
NullPointerException. This is, because we do at first try to retrieve a
property descriptor from PropertyDescriptor registry and then just do a
checkNotNull with it.
I thing it would be more appropriate to throw a NoSuchMethodException,
if a string was passed in, that does not correspond to any of the
properties (to differentiate this case from a null argument been passed).
If you agree the implementation of set(String), get(String)
getIndexed(String) will have to change as well.
Regards,
Benedikt
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org