net.sf.jga.fn.property
public class SetProperty<T,R> extends AbstractBinaryFunctor<T,R,R> implements Serializable
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 © 2002 David A. Hall
Nested Class Summary | |
---|---|
interface | SetProperty.Visitor
Interface for classes that may interpret a SetProperty
function. |
Constructor Summary | |
---|---|
SetProperty(String propName, Class propType)
Builds a SetProperty for the given property, which must be of the
given class. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(SetProperty) method, if it
implements the nested Visitor interface. |
R | fn(T arg, R val)
Sets the designated property of the argument to the given value. |
String | toString() |
Throws: IllegalArgumentException if either argument is omitted.
visit(SetProperty)
method, if it
implements the nested Visitor interface.Returns: the value returned by the designated property's setter method
Throws: EvaluationException if the argument does not have the designated public property, or if it is accept the given value.
UNKNOWN: arg the object whose property will be set val the value to which the property will be set