Package adams.core.classmanager
Class ClassManager
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.classmanager.ClassManager
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,SizeOfHandler,Serializable
public class ClassManager extends CustomLoggingLevelObject
Manages the loading of classes, delegates it to the responsible actual manager.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClassManager.NoManagerFoundDummy manager to be used in mapping if no manager was found.
-
Field Summary
Fields Modifier and Type Field Description protected DefaultClassManagerm_DefaultManagerthe default manager.protected List<CustomClassManager>m_Managersthe class managers.protected Map<String,CustomClassManager>m_Mappingthe relation between classname and manager.protected ClassManager.NoManagerFoundm_NoManagerFoundthe "no manager found" dummy.protected static ClassManagerm_Singletonthe singleton.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedClassManager()Initializes the manager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectdeepCopy(Object o)Creates a deep copy of the given object (must be serializable!).ObjectdeepCopy(Object o, boolean silent)Creates a deep copy of the given object (must be serializable!).protected CustomClassManagerdetermineManager(String classname)Determines the manager to use for the class.ClassforName(String classname)Obtains the Class for the name.static ClassManagergetSingleton()Returns the singleton of the class manager.protected voidinitialize()Configures the actual managers and data structures.booleanisAvailable(String classname)Checks whether the class can be loaded.Map<String,Integer>statistics()Returns counts per class manager.-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Managers
protected List<CustomClassManager> m_Managers
the class managers.
-
m_DefaultManager
protected DefaultClassManager m_DefaultManager
the default manager.
-
m_NoManagerFound
protected ClassManager.NoManagerFound m_NoManagerFound
the "no manager found" dummy.
-
m_Mapping
protected Map<String,CustomClassManager> m_Mapping
the relation between classname and manager.
-
m_Singleton
protected static ClassManager m_Singleton
the singleton.
-
-
Method Detail
-
initialize
protected void initialize()
Configures the actual managers and data structures.
-
determineManager
protected CustomClassManager determineManager(String classname)
Determines the manager to use for the class.- Parameters:
classname- the class to get the manager for- Returns:
- the manager
-
forName
public Class forName(String classname) throws Exception
Obtains the Class for the name.- Parameters:
classname- the class to load- Returns:
- the class
- Throws:
Exception- if loading failed
-
isAvailable
public boolean isAvailable(String classname)
Checks whether the class can be loaded.- Parameters:
classname- the class name to check- Returns:
- true if the class exists
-
deepCopy
public Object deepCopy(Object o)
Creates a deep copy of the given object (must be serializable!). Returns null in case of an error.- Parameters:
o- the object to copy- Returns:
- the deep copy
-
deepCopy
public Object deepCopy(Object o, boolean silent)
Creates a deep copy of the given object (must be serializable!). Returns null in case of an error.- Parameters:
o- the object to copysilent- whether to suppress error output- Returns:
- the deep copy
-
statistics
public Map<String,Integer> statistics()
Returns counts per class manager.- Returns:
- the statistics
-
getSingleton
public static ClassManager getSingleton()
Returns the singleton of the class manager.- Returns:
- the singleton
-
-