net.sf.jga.fn.property
public class ConstructUnary<T,R> extends AbstractUnaryFunctor<T,R> implements Serializable
Note that declaring the argument type or the return type incorrectly can result in an EvaluationException being thrown on construction or a ClassCastException being thrown when the functor is invoked: the compiler cannot check the argument type or return type of a reflectively loaded constructor.
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | ConstructUnary.Visitor
Interface for classes that may interpret a ConstructUnary
predicate. |
Constructor Summary | |
---|---|
ConstructUnary(Class argclass, Class ctorclass)
Builds a predicate 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.
|
String | toString() |
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);
Throws: EvaluationException if the constructor cannot be found IllegalArgumentException if either argument is omitted
visit(ConstructUnary)
method, if it
implements the nested Visitor interface.Returns: the object built by the constructor
UNKNOWN: arg the value to be passed to the constructor