net.sf.jga.fn.property
Class ConstructDefault<R>

java.lang.Object
  extended by net.sf.jga.fn.Generator<R>
      extended by net.sf.jga.fn.property.ConstructDefault<R>
All Implemented Interfaces:
java.io.Serializable, Visitable

public class ConstructDefault<R>
extends Generator<R>

Generator that constructs an object of the given class using its default constructor.

Copyright © 2004 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface ConstructDefault.Visitor
          Interface for classes that may interpret a ConstructDefault functor.
 
Constructor Summary
ConstructDefault(java.lang.Class<R> ctorclass)
          Builds a generator that will return instances of the class ctorclass, built using the default constructor.
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(ConstructDefault) method, if it implements the nested Visitor interface.
 R gen()
          Builds an object via the default constructor
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructDefault

public ConstructDefault(java.lang.Class<R> ctorclass)
Builds a generator that will return instances of the class ctorclass, built using the default constructor.

Throws:
java.lang.IllegalArgumentException - if the constructor cannot be found
java.lang.IllegalArgumentException - if the class argument is omitted or does not define an accessible default constructor.
Method Detail

gen

public R gen()
Builds an object via the default constructor

Specified by:
gen in class Generator<R>
Returns:
the object built by the constructor

accept

public void accept(Visitor v)
Calls the Visitor's visit(ConstructDefault) method, if it implements the nested Visitor interface.

Specified by:
accept in interface Visitable
Overrides:
accept in class Generator<R>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2005 David A. Hall. All Rights Reserved.