|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.fn.Functor<R> net.sf.jga.fn.BinaryFunctor<T,R,R> net.sf.jga.fn.property.SetProperty<T,R>
public class SetProperty<T,R>
Binary Functor that sets the named property of the first argument to the value. The property name and type are set at construction. The return value will be that which the argument's property setter method returns (generally either null or the old value).
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-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
SetProperty.Visitor
Interface for classes that may interpret a SetProperty function. |
Constructor Summary | |
---|---|
SetProperty(java.lang.Class<T> argType,
java.lang.String propName,
java.lang.Class<R> propType)
Builds a SetProperty that will return the value of the named property of an instance of type argType. |
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. |
java.lang.String |
getPropertyName()
Returns the name of the property that this functor sets. |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.BinaryFunctor |
---|
bind, bind0th, bind1st, bind2nd, bindNth, compose, compose, composeNth, distribute, eval, generate, generate1st, generate2nd, generateNth |
Methods inherited from class net.sf.jga.fn.Functor |
---|
composeNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SetProperty(java.lang.Class<T> argType, java.lang.String propName, java.lang.Class<R> propType)
java.lang.IllegalArgumentException
- if either argument is omitted, or if
there is no such setter method in type argType.Method Detail |
---|
public java.lang.String getPropertyName()
public R fn(T arg, R val)
fn
in class BinaryFunctor<T,R,R>
EvaluationException
- if the argument does not have the designated
public property, or if it is accept the given value.public void accept(Visitor v)
visit(SetProperty)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<R>
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |