zinger.util.recycling
Class ClassInstanceGenerator

java.lang.Object
  |
  +--zinger.util.recycling.ClassInstanceGenerator
All Implemented Interfaces:
ObjectGenerator
Direct Known Subclasses:
CollectionGenerator

public class ClassInstanceGenerator
extends java.lang.Object
implements ObjectGenerator


Field Summary
protected  java.lang.Object[] args
           
protected  java.lang.reflect.Constructor constructor
           
static java.lang.Class[] EMPTY_CLASS_ARRAY
           
 
Constructor Summary
ClassInstanceGenerator(java.lang.Class c)
           
ClassInstanceGenerator(java.lang.reflect.Constructor constructor, java.lang.Object[] args)
           
 
Method Summary
protected static java.lang.reflect.Constructor getDefaultConstructor(java.lang.Class c)
           
 java.lang.Object newObject()
          Creates a new instance.
 boolean prepareObject(java.lang.Object obj, java.lang.Object arg)
          An empty implementation for the sake of not having to declare this class abstract.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

EMPTY_CLASS_ARRAY

public static final java.lang.Class[] EMPTY_CLASS_ARRAY

constructor

protected final java.lang.reflect.Constructor constructor

args

protected final java.lang.Object[] args
Constructor Detail

ClassInstanceGenerator

public ClassInstanceGenerator(java.lang.reflect.Constructor constructor,
                              java.lang.Object[] args)
                       throws java.lang.IllegalArgumentException

ClassInstanceGenerator

public ClassInstanceGenerator(java.lang.Class c)
                       throws java.lang.IllegalArgumentException
Method Detail

getDefaultConstructor

protected static java.lang.reflect.Constructor getDefaultConstructor(java.lang.Class c)
                                                              throws java.lang.IllegalArgumentException

newObject

public java.lang.Object newObject()
Description copied from interface: ObjectGenerator
Creates a new instance.
Specified by:
newObject in interface ObjectGenerator

prepareObject

public boolean prepareObject(java.lang.Object obj,
                             java.lang.Object arg)
An empty implementation for the sake of not having to declare this class abstract.
Specified by:
prepareObject in interface ObjectGenerator
Following copied from interface: zinger.util.recycling.ObjectGenerator
Returns:
true if the preparation succeeded
false if there is something wrong with the object passed
Throws:
java.lang.IllegalArgumentException - if the argument passed for preparation is inappropriate