|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmandala.jacob.Instanciator
Allows indirect instanciation of objects.
This class provides an elegant solution for both remote instanciaton and making non-serializable objects remotely accessible by being remotely inserted into an active map.
Each instance of this class has a related active map in which fresh
instances are stored. Each instance also has a default constructor which is
returned by getConstructor() to prevent caller from specifying same
constructor multiple times.
ActiveMap,
Serialized Form| Field Summary | |
protected ConstructorOp |
constructor
Prevents multiple same constructor specification |
| Method Summary | |
boolean |
equals(java.lang.Object o)
|
ActiveMap |
getActiveMap()
Returns the related ActiveMap. |
ConstructorOp |
getConstructor()
Returns the default constructor. |
static StoredObjectReference |
getInstance(ActiveMap activeMap)
Equivalent to getInstance(activeMap, null). |
static StoredObjectReference |
getInstance(ActiveMap activeMap,
ConstructorOp constructor)
Get the StoredObjectReference on the
Instanciator instance which is related to the given
activeMap. |
int |
hashCode()
|
java.lang.Object |
instanciate(ConstructorOp constructor,
java.lang.Object[] args)
Instanciate a new object and associates it with a new key. |
java.lang.Object |
instanciate(java.lang.Object[] args)
Equivalent to instanciate(getConstructorOp(), args). |
java.lang.Object |
instanciateWith(ConstructorOp constructor,
java.lang.Object[] keys)
Instanciate a new object with parameters taken from the active map and associates it with a new key. |
java.lang.Object |
instanciateWith(java.lang.Object[] keys)
Equivalent to instanciateWith(getConstructorOp(),
keys). |
ConstructorOp |
setConstructor(ConstructorOp constructor)
Sets the default constructor. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ConstructorOp constructor
Prevents multiple same constructor specification
| Method Detail |
public static StoredObjectReference getInstance(ActiveMap activeMap,
ConstructorOp constructor)
Get the StoredObjectReference on the
Instanciator instance which is related to the given
activeMap.
If an instance is not already mapped to the given
activeMap is is created and stored into the
activeMap so the returned
StoredObjectReference references it.
activeMap - the active map in which the instanciator must
inserts fresh instancesconstructor - the default constructor to use
StoredObjectReference referencing the
instanciator related to the given activeMappublic static StoredObjectReference getInstance(ActiveMap activeMap)
Equivalent to getInstance(activeMap, null).
activeMap - an ActiveMap value
StoredObjectReference valuepublic boolean equals(java.lang.Object o)
public int hashCode()
public ConstructorOp getConstructor()
Returns the default constructor.
ConstructorOp valuepublic ConstructorOp setConstructor(ConstructorOp constructor)
Sets the default constructor.
constructor - a ConstructorOp value
ConstructorOp valuepublic ActiveMap getActiveMap()
Returns the related ActiveMap.
ActiveMap value
public java.lang.Object instanciate(java.lang.Object[] args)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException
Equivalent to instanciate(getConstructorOp(), args).
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetExceptioninstanciate(ConstructorOp, Object[])
public java.lang.Object instanciate(ConstructorOp constructor,
java.lang.Object[] args)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException
Instanciate a new object and associates it with a new key.
constructor - the constructor to use for the instanciationargs - the arguments used for the instanciation
java.lang.InstantiationException - if the class that declares the underlying
constructor represents an abstract class.
InvocationTargetException - if the underlying constructor throws
an exception.
java.lang.ExceptionInInitializerError - if the initialization provoked by
this method fails.
java.lang.ClassCastException - if the class of the specified key or value
prevents it from being stored in this map.
java.lang.IllegalArgumentException - if some aspect of this key or value
prevents it from being stored in this map.
java.lang.NullPointerException - this map does not permit null keys or
values, and the specified key or value is null.
java.lang.IllegalAccessException - if the underlying constructor is
inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal
parameters differ, or if an unwrapping or method invocation conversion
fails.Map.put(Object, Object),
ConstructorOp.newInstance(Object[])
public java.lang.Object instanciateWith(java.lang.Object[] keys)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException
Equivalent to instanciateWith(getConstructorOp(),
keys).
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetExceptioninstanciate(ConstructorOp, Object[])
public java.lang.Object instanciateWith(ConstructorOp constructor,
java.lang.Object[] keys)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException
Instanciate a new object with parameters taken from the active map and associates it with a new key.
The key arguments represent the stored objects
to use for the instanciation.
constructor - the constructor to use for the instanciationkeys - the mapping of the stored objects used for the
instanciation
java.lang.InstantiationException - if the class that declares the underlying
constructor represents an abstract class.
InvocationTargetException - if the underlying constructor throws
an exception.
java.lang.ExceptionInInitializerError - if the initialization provoked by
this method fails.
java.lang.ClassCastException - if the class of the specified key or value
prevents it from being stored in this map.
java.lang.IllegalArgumentException - if some aspect of this key or value
prevents it from being stored in this map.
java.lang.NullPointerException - this map does not permit null keys or
values, and the specified key or value is null.
java.lang.IllegalAccessException - if the underlying constructor is
inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal
parameters differ, or if an unwrapping or method invocation conversion
fails.Map.put(Object, Object),
ConstructorOp.newInstance(Object[])public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||