net.sf.jga.fn.property |
Provides Functors and Predicates that operate on Java Objects that observe
the bean standard naming convention. This is the home for functors that use
reflection in construction and/or evaluation.
In previous versions, the constructors used in this package created type-unsafe
functors. This was due to an incomplete understanding on my part of the
implications of parameterizing the Class class. It's somewhat more obvious
to me know how clever this is: it allows the compiler to check that the class
given to a method is in fact the same class with which the functor is
parameterized. The previous constructors did not take the class of the
argument, or they used unparameterized classes as arguments: they typically
performed some reflection on the first argument passed to fn(), lazily
loading the Method or Constructor on the first call.
In this version, those constructors are deprecated. They are likely to
disappear in a future version (unless they prove necessary to the success
of some of the project goals).
|
Java Source File Name | Type | Comment |
ArrayBinary.java | Class | Binary Functor that returns its arguments in a two element array.
Copyright © 2004-2005 David A. |
ArrayUnary.java | Class | Unary Functor that returns its arguments in a one element array.
Copyright © 2004-2005 David A. |
Cast.java | Class | UnaryFunctor that returns its argument, cast to the given type. |
CompareProperty.java | Class | Unary Predicate that compares the value of the named property to the
given value. |
Construct.java | Class | Unary Functor that constructs an object of the given class. |
ConstructDefault.java | Class | Generator that constructs an object of the given class using its default
constructor.
Copyright © 2004-2005 David A. |
ConstructUnary.java | Class | Unary Functor that constructs an object of the given class via a
one-argument constructor.
Copyright © 2003-2005 David A. |
GetField.java | Class | Unary Functor that returns the value of the named field for the argument.
The field name and type are set at construction.
Copyright © 2002-2005 David A. |
GetProperty.java | Class | Unary Functor that returns the value of the named property for the argument.
The property name and type are set at construction.
Copyright © 2002-2005 David A. |
InstanceOf.java | Class | Functor that returns true if the argument is an instance of given type.
NOTE: the generic parm T is not related to the class parameter. |
InvokeMethod.java | Class | Functor that invokes a method described at construction and returns the
result or null if the result is void. |
InvokeNoArgMethod.java | Class | Functor that invokes a no-arg method named at construction and returns the
result or null if the result is void.
Note that declaring the return type incorrectly can result in
ClassCastExceptions being thrown when the functor is invoked: the compiler
cannot check the return type of a reflectively loaded method.
Copyright © 2003-2005 David A. |
PropertyFunctors.java | Class | Static factory methods for the functors in the Property package.
Copyright © 2006 David A. |
SetField.java | Class | Binary Functor that sets the named field of the first argument to the
value. |
SetProperty.java | Class | Binary Functor that sets the named property of the first argument to the
value. |