Package jade.util
Class ObjectManager
- java.lang.Object
-
- jade.util.ObjectManager
-
public class ObjectManager extends Object
Utility class to manage instances of classes with attached properties i.e. classes specified in the form
foo.Bar[key1=value1,key2=value2...] This class allows registering "Loaders" for given types of objects (e.g. agents) and successively load such objects using them
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObjectManager.LoaderThe interface to be implemented by classes that can be registered to load objects of a given type
-
Field Summary
Fields Modifier and Type Field Description static StringAGENT_TYPEThe constant representing the "agent" typestatic StringCLASS_NAME
-
Constructor Summary
Constructors Constructor Description ObjectManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddLoader(String type, ObjectManager.Loader loader)Register aLoaderfor a given type of object.static Objectload(String extendedClassName, String type)Try to load an object of a given type by means of the loaders (if any) associated to that type.static booleanremoveLoader(String type, ObjectManager.Loader loader)
-
-
-
Field Detail
-
CLASS_NAME
public static final String CLASS_NAME
- See Also:
- Constant Field Values
-
AGENT_TYPE
public static final String AGENT_TYPE
The constant representing the "agent" type- See Also:
- Constant Field Values
-
-
Method Detail
-
addLoader
public static void addLoader(String type, ObjectManager.Loader loader)
Register aLoaderfor a given type of object. Note that more than oneLoadercan be associated to a given type of object.- Parameters:
type- The type of object the registeredLoaderis associated toloader- TheLoaderinstance.
-
removeLoader
public static boolean removeLoader(String type, ObjectManager.Loader loader)
-
load
public static Object load(String extendedClassName, String type) throws ClassNotFoundException, IllegalAccessException, InstantiationException
Try to load an object of a given type by means of the loaders (if any) associated to that type.- Parameters:
extendedClassName- The class of the object to load in the form foo.Bar[key1=value1;key2=value2...]type- The type of object to load- Returns:
- The loaded object or null if no loader is suitable to load the object.
- Throws:
ClassNotFoundExceptionIllegalAccessExceptionInstantiationException
-
-