Hi, > today I got the time to write some more code for BeanUtils2, so I started to > implement setIndexed().
nice, it is missing indeed. > 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) to perform that check, you should get the original property, that non necessarily could/has to be exposed in real use cases, and then verify the index is available. Refer how the original BeanUtils handles that, that is something users are already used to. > 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. go for NoSuchMethodException - but please don't mix stuff, please provide separated patches - maybe the NoSuchMethodException first, then setIndexedProperty() implementation. TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org