public final class ClassRegistry
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IMPLS_LOCATION_PROPERTY
Location of implementations...
|
static java.lang.String |
TYPES_LOCATION_PROPERTY
Location of types...
|
Modifier and Type | Method and Description |
---|---|
void |
addRegisterableType(java.lang.Class<?> type)
Adds a class to the list of types whose implementations can be registered
(only implementations of certain types can be registered).
|
java.util.List<java.lang.Class<?>> |
getImplementations(java.lang.Class<?> type) |
static ClassRegistry |
getInstance() |
void |
register(java.lang.Class<?> implementation)
Registers an implementation against any of the registerable types which it is
assignable from.
|
void |
register(java.lang.String implementationName)
As register(Class), but by name.
|
public static final java.lang.String TYPES_LOCATION_PROPERTY
public static final java.lang.String IMPLS_LOCATION_PROPERTY
public static ClassRegistry getInstance()
public void addRegisterableType(java.lang.Class<?> type)
type
- Type to add to list of registerable typespublic void register(java.lang.Class<?> implementation)
implementation
- Class to register as an implementation of matching registerable typespublic void register(java.lang.String implementationName) throws java.lang.ClassNotFoundException
implementationName
- Name of implementation to registerjava.lang.ClassNotFoundException
- if the class doesn't exist?public java.util.List<java.lang.Class<?>> getImplementations(java.lang.Class<?> type)
type
- A registerable type