voji.utils
Class Instance

java.lang.Object
  |
  +--voji.utils.Instance

public class Instance
extends java.lang.Object

This class holds parameters for the constructor of a class. However, an instance will only be created if needed.


Field Summary
protected  java.lang.reflect.Constructor constructor
          The constructor which is to be used
protected  java.lang.Object instance
          The instance or null if the instance hasn't been created yet
protected  java.lang.Object[] params
          The parameters which have to be passed to the constructor
 
Constructor Summary
Instance()
          Constructs a new empty Instance instance
Instance(java.lang.Class cl, java.lang.Object[] params)
          Constructs a new Instance instance holding an instance of the given Class.
 
Method Summary
protected  java.lang.Object create()
          Creates the instance.
 java.lang.Object get()
          Returns the instance and creates it, if necessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constructor

protected java.lang.reflect.Constructor constructor
The constructor which is to be used


params

protected java.lang.Object[] params
The parameters which have to be passed to the constructor


instance

protected java.lang.Object instance
The instance or null if the instance hasn't been created yet

Constructor Detail

Instance

public Instance()
Constructs a new empty Instance instance


Instance

public Instance(java.lang.Class cl,
                java.lang.Object[] params)
Constructs a new Instance instance holding an instance of the given Class.

Parameters:
cl - The Class which has to be instantiated
params - An Array containing the parameters of the constructor which has to be used
Method Detail

create

protected java.lang.Object create()
Creates the instance. This method can be overwritten in case there's any more initialisation necessary.


get

public java.lang.Object get()
Returns the instance and creates it, if necessary