Default implementation of ListProperty. This implementation uses reflection to call methods on an underlying configurable object in order to get and set multiple property values.
The easiest way to use this class is via the factory method getListProperty(...). In this case, the class of configuration.getConfigurable() is searched for methods that appear to be getters, setters, etc. of a named parameter. For example if the parameter is named "X" and has type Foo, then a method getX(int) with return type Foo is taken as the getter. Methods to get, set, insert, add, remove values, get/set arrays, and get lists are searched based on return and argument types, and a variety of probable names (including bean patterns). If there are not methods available for at least getting and counting values, null is returned. The set of other methods found determines whether the property is mutable and has fixed cardinality (i.e. # of values).
If customization is needed, there are two alternative public constructors that accept user-specified methods, and additional functionality can then be imparted via setSetter(...), setArraySetter(...), and setInserter(...). This allows use of methods with unexpected names, although the expected arguments and return types are still required.
If further customization is needed (e.g. using an Integer index argument instead of an int), then the methods of this class must be overridden.
@author Bryan Tripp
|
|