|
|||||||||
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.UnaryFunctor<T,R> net.sf.jga.fn.property.ConstructUnary<T,R>
public class ConstructUnary<T,R>
Unary Functor that constructs an object of the given class via a one-argument constructor.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
ConstructUnary.Visitor
Interface for classes that may interpret a ConstructUnary predicate. |
Constructor Summary | |
---|---|
ConstructUnary(java.lang.Class<T> argclass,
java.lang.Class<R> ctorclass)
Builds a functor that will build an object of class ctorclass , given an argument of class argclass . |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(ConstructUnary) method, if it
implements the nested Visitor interface. |
R |
fn(T arg)
Builds an object via a one-arg constructor, passing the given value. |
java.lang.reflect.Constructor<R> |
getConstructor()
Lazily loads the constructor |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.UnaryFunctor |
---|
bind, bind0th, bindNth, compose, compose, compose, composeNth, composeNth, eval, generate, generateNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConstructUnary(java.lang.Class<T> argclass, java.lang.Class<R> ctorclass)
ctorclass
, given an argument of class argclass
.
The classes passed to the constructor must be assignable to the generic
arguments (when generics are in use):
ConstructUnary ctor =
new ConstructUnary(String.class,Integer.class);
java.lang.IllegalArgumentException
- if either argument is omitted, or if the
constructor cannot be found.Method Detail |
---|
public java.lang.reflect.Constructor<R> getConstructor() throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
public R fn(T arg)
fn
in class UnaryFunctor<T,R>
public void accept(Visitor v)
visit(ConstructUnary)
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 |