|
|||||||||
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<java.lang.Object[],R> net.sf.jga.fn.property.Construct<R>
public class Construct<R>
Unary Functor that constructs an object of the given class. The functor argument is an array containing the arguments to the class' constructor.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
Construct.Visitor
Interface for classes that may interpret a Construct predicate. |
Constructor Summary | |
---|---|
Construct(java.lang.Class<?>[] argclasses,
java.lang.Class<R> ctorclass)
Builds a functor that will build an object of class ctorclass , given arguments of classes in
argclasses . |
|
Construct(java.lang.Class<R> ctorclass,
java.lang.Class<?>... argclasses)
Builds a functor that will build an object of class ctorclass , given arguments of classes in
argclasses . |
|
Construct(java.lang.reflect.Constructor<R> ctor)
Builds a functor that will build an object using the given constructor. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(Construct) method, if it
implements the nested Visitor interface. |
R |
fn(java.lang.Object[] args)
Builds an object via the designated constructor, passing the given array of argument values. |
java.lang.reflect.Constructor<R> |
getConstructor()
Lazy loads the constructor (used if the functor is called after deserialization) |
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 Construct(java.lang.Class<R> ctorclass, java.lang.Class<?>... argclasses)
ctorclass
, given arguments of classes in
argclasses
.
java.lang.IllegalArgumentException
- if either argument is omitted, or if the
constructor cannot be found.public Construct(java.lang.Class<?>[] argclasses, java.lang.Class<R> ctorclass)
ctorclass
, given arguments of classes in
argclasses
.
java.lang.IllegalArgumentException
- if either argument is omitted, or if the
constructor cannot be found.public Construct(java.lang.reflect.Constructor<R> ctor)
java.lang.IllegalArgumentException
- if the constructor is omitted.Method Detail |
---|
public java.lang.reflect.Constructor<R> getConstructor() throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
public R fn(java.lang.Object[] args)
fn
in class UnaryFunctor<java.lang.Object[],R>
public void accept(Visitor v)
visit(Construct)
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 |