|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.fn.UnaryFunctor<T,R>
net.sf.jga.fn.property.GetField<T,R>
public class GetField<T,R>
Unary Functor that returns the value of the named field for the argument. The field name and type are set at construction.
Copyright © 2002 David A. Hall
| Nested Class Summary | |
|---|---|
static interface |
GetField.Visitor
Interface for classes that may interpret a GetField function. |
| Constructor Summary | |
|---|---|
GetField(java.lang.Class<T> argclass,
java.lang.reflect.Field field)
Builds a GetField for the given field |
|
GetField(java.lang.Class<T> argclass,
java.lang.String fieldName)
Builds a GetField for the given field, using the given class to find the desired field. |
|
| Method Summary | |
|---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(GetField) field, if it
implements the nested Visitor interface. |
R |
fn(T arg)
Returns the value of the designated field of the argument |
java.lang.String |
getFieldName()
Returns the name of the field that this functor retrieves. |
java.lang.Class<R> |
getFieldType()
Returns the type of field that this functor retrieves. |
java.lang.String |
toString()
|
| Methods inherited from class net.sf.jga.fn.UnaryFunctor |
|---|
bind, compose, compose, generate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GetField(java.lang.Class<T> argclass,
java.lang.reflect.Field field)
java.lang.IllegalArgumentException - if the field is null, or is not a field
of the given class
public GetField(java.lang.Class<T> argclass,
java.lang.String fieldName)
java.lang.IllegalArgumentException - if the field name is null or empty,| Method Detail |
|---|
public java.lang.String getFieldName()
public java.lang.Class<R> getFieldType()
public R fn(T arg)
fn in class UnaryFunctor<T,R>EvaluationException - if the argument does not have the designated
public field, or if it is not of the correct type.public void accept(Visitor v)
visit(GetField) field, if it
implements the nested Visitor interface.
accept in interface Visitableaccept in class UnaryFunctor<T,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 | ||||||||