Package com.bc.ceres.core
Class ExtensionManager
- java.lang.Object
-
- com.bc.ceres.core.ExtensionManager
-
public abstract class ExtensionManager extends Object
TheExtensionManager
is a service used to register and unregisterExtensionFactory
s with a given type of an extensible object.- See Also:
Extensible
,ExtensibleObject
-
-
Constructor Summary
Constructors Constructor Description ExtensionManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <E> E
getExtension(Object extensibleObject, Class<E> extensionType)
Gets a dynamic extension for the given (extensible) object.abstract ExtensionFactory[]
getExtensionFactories(Class<?> extensibleType)
Gets all extension factories registered for the given type.static ExtensionManager
getInstance()
abstract void
register(Class<?> extensibleType, ExtensionFactory factory)
Registers an extension factory for the given extensible type.static void
setInstance(ExtensionManager instance)
abstract void
unregister(Class<?> extensibleType, ExtensionFactory factory)
Unregisters an extension factory for the given extensible type.
-
-
-
Method Detail
-
getInstance
public static ExtensionManager getInstance()
- Returns:
- The service instance.
-
setInstance
public static void setInstance(ExtensionManager instance)
- Parameters:
instance
- The service instance.
-
register
public abstract void register(Class<?> extensibleType, ExtensionFactory factory)
Registers an extension factory for the given extensible type.- Parameters:
extensibleType
- The extensible type.factory
- The factory.
-
unregister
public abstract void unregister(Class<?> extensibleType, ExtensionFactory factory)
Unregisters an extension factory for the given extensible type.- Parameters:
extensibleType
- The extensible type.factory
- The factory.
-
getExtensionFactories
public abstract ExtensionFactory[] getExtensionFactories(Class<?> extensibleType)
Gets all extension factories registered for the given type.- Parameters:
extensibleType
- The extensible type.- Returns:
- The list of extension factories. May be empty.
-
getExtension
public <E> E getExtension(Object extensibleObject, Class<E> extensionType)
Gets a dynamic extension for the given (extensible) object.- Parameters:
extensibleObject
- The (extensible) object.extensionType
- The type of the requested extension.- Returns:
- The extension instance, or
null
if the given object is not extensible by this factory or if the factory fails to provide that extension. - See Also:
ExtensionFactory.getExtension(Object, Class)
-
-