|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ls.util.objectcontrol.DynamicObjectController
Object controller class, which allows to dynamically instantiate and configure objects in two ways:
IConfigurable
interface.
Constructor Summary | |
DynamicObjectController()
|
Method Summary | |
void |
defineObject(Object key,
String className)
Defines access of an object of the given class. |
void |
defineObject(Object key,
String className,
Map configuration)
Stores an object definition of the given class in an internal Map under the given key. |
Object |
getInstanceFromDefined(Object key)
Retrieves a previously stored object defininition from an internal Map and instantiates that object. |
Object |
getLoaded(Object key)
Retrieves a previously loaded object from an internal Map. |
void |
loadObject(Object key,
String className)
Instantiates an object of the given class. |
void |
loadObject(Object key,
String className,
Map configuration)
Instantiates and possibly configures an object of the given class. |
void |
removeDefined(Object key)
Deletes a previously stored object definition from an internal Map. |
Object |
removeLoaded(Object key)
Deletes a previously loaded object from an internal Map. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DynamicObjectController()
Method Detail |
public void loadObject(Object key, String className, Map configuration) throws ObjectControlException
IConfigurable
.
If yes, configure(configuration)
with the given Map is called on the new
object. key
- with help of the key one later can access the loaded objectclassName
- fully qualified class name of object to be instantiatedconfiguration
- parameters for configuration, see IConfigurable.configure(Map)
ObjectControlException
- if the given key is already used for another stored object
or if the instantiation of the object fails
or if the configuration of the object fails
or if any of the arguments is nullloadObject(Object,String)
,
getLoaded(java.lang.Object)
,
removeLoaded(java.lang.Object)
public void loadObject(Object key, String className) throws ObjectControlException
key
- with help of the key one later can access the loaded objectclassName
- fully qualified class name of object to be instantiatedObjectControlException
- if the given key is already used for another stored object
or if the instantiation of the object fails
or if any of the arguments is nullloadObject(Object,String,Map)
,
getLoaded(java.lang.Object)
,
removeLoaded(java.lang.Object)
public Object getLoaded(Object key) throws ObjectControlException
key
- identifies the object to getObjectControlException
- if no object is stored under the given key
or if key is nullloadObject(Object,String,Map)
,
loadObject(Object,String)
,
removeLoaded(java.lang.Object)
public Object removeLoaded(Object key) throws ObjectControlException
key
- identifies the object to deleteObjectControlException
- if no object is stored under the given key
or if key is nullloadObject(Object,String,Map)
,
loadObject(Object,String)
,
getLoaded(java.lang.Object)
public void defineObject(Object key, String className, Map configuration) throws ObjectControlException
key
- with help of the key one later can access the defined objectclassName
- fully qualified class name of object to be definedconfiguration
- parameters for configuration, see IConfigurable.configure(Map)
ObjectControlException
- if the given key is already used for another defined object
or if any of the arguments is nulldefineObject(Object,String)
,
getInstanceFromDefined(java.lang.Object)
,
removeDefined(java.lang.Object)
public void defineObject(Object key, String className) throws ObjectControlException
key
- with help of the key one later can access the defined objectclassName
- fully qualified class name of object to be definedObjectControlException
- if the given key is already used for another defined object
or if any of the arguments is nulldefineObject(Object,String,Map)
,
getInstanceFromDefined(java.lang.Object)
,
removeDefined(java.lang.Object)
public Object getInstanceFromDefined(Object key) throws ObjectControlException
IConfigurable
, IConfigurable.configure(Map)
with the stored configuration parameters is called on
the new object.key
- identifies the object definition to be used for instantiating a new objectObjectControlException
- if no object definition is stored under the given key
or if the instantiation of the object fails
or if the configuration of the object fails
or if key is nulldefineObject(Object,String,Map)
,
defineObject(Object,String)
,
removeDefined(java.lang.Object)
public void removeDefined(Object key) throws ObjectControlException
key
- identifies the object definition to deleteObjectControlException
- if no object definition is stored under the given key
or if key is nulldefineObject(Object,String,Map)
,
defineObject(Object,String)
,
getInstanceFromDefined(java.lang.Object)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |