AccessorFactory
| Kind of class: | public class |
|---|---|
| Package: | com.bourre.core |
| Inherits from: | none |
| Author: | Cédric Néhémie |
| Classpath: | com.bourre.core.AccessorFactory |
| File last modified: | Monday, 24 November 2008, 11:36:49 |
A factory for
With the
access to a property or to a method. The creational methods of the factory
will return the corresponding concret accessor.
Accessor and AccessorComposer creation.With the
AccessorFactory, you don't have to know if you attempt toaccess to a property or to a method. The creational methods of the factory
will return the corresponding concret accessor.
See also:
Summary
Class methods
- getAccessor (t:Object, setter:String, getter:String = null) : Accessor
- Returns an accessor object for the passed-in property or methods of the
- getMultiAccessor (t:Object, setter:Array, getter:Array = null) : AccessorComposer
- Returns an accessor object for the passed-in properties or methods of the
Class methods
getAccessor
Returns an accessor object for the passed-in property or methods of the
specified target object. The concret type of the accessor cannot be
known before the call, as for any other factories.
specified target object. The concret type of the accessor cannot be
known before the call, as for any other factories.
In the case of accessing to method member, the setter and getter arguments must be set.
Parameters:
t :
the object onto which access member(s)
setter:
name of the setter property on the target
getter:
name of the getter property on the target, used
only if the setter property is a function
only if the setter property is a function
Returns:
- a concret
Accessorto the specified member(s)
Throws:
- {VISDOC_LINK_0}
NullPointerException— The passed-in target is
null - {VISDOC_LINK_1}
NoSuchFieldException— The target object doesn't
own any field named as setter - {VISDOC_LINK_2}
NoSuchMethodException— There'is no getter
method to associate with the corresponding setter
getMultiAccessor
public static function getMultiAccessor (
t:Object,
setter:Array,
getter:Array = null) : AccessorComposer
Returns an accessor object for the passed-in properties or methods of the
specified target object. The concret type of the accessor cannot be
known before the call, as for any other factories.
specified target object. The concret type of the accessor cannot be
known before the call, as for any other factories.
In the case of accessing to method member, the setter and getter arguments must be set.
Parameters:
t :
the object onto which access member(s)
setter:
array of setter member's name
getter:
array of getter member's name, when mixing properties
and methods, the same order must be conservated in the
two arrays
and methods, the same order must be conservated in the
two arrays
Returns:
- a concret
AccessorComposerto the specified member(s)
Throws:
- {VISDOC_LINK_0}
NullPointerException— The passed-in target is
null - {VISDOC_LINK_1}
NoSuchFieldException— The target object doesn't
own any field named as setter - {VISDOC_LINK_2}
NoSuchMethodException— There'is no getter
method to associate with the corresponding setter
Example:
- The orders of the parameters must be equivalent both in the setter
array and in the getter array. When mixing properties and methods, the
getter name of a properties isnull, as the properties may generally
provides read and write access to it.AccessorFactory.getMultiAccessor (
anObject,
[ "someProperty", "getSomething", "getAnotherThing" ],
[ null, "setSomething", "setAnotherThing" ]
);