public class OBProvider extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_FILE_NAME |
| Constructor and Description |
|---|
OBProvider() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Class<T> clz)
Checks the registry for which class should be used for the passed clz.
|
Object |
get(String name)
Returns an instance of the requested service.
|
static OBProvider |
getInstance() |
boolean |
isRegistered(Class<?> clz)
Returns true if the clz is registered.
|
boolean |
isRegistered(String name)
Checks if a service is registered under the name passed as a parameter.
|
void |
register(Class<?> registrationClass,
Class<?> instanceClass,
boolean overwrite)
Register an instance for an internal Openbravo class (the registrationClass).
|
void |
register(String name,
Class<?> instanceClass,
boolean overwrite)
Register an instance for an internal Openbravo class or service (the name).
|
protected void |
register(String prefix,
InputStream is) |
protected void |
register(String prefix,
String configFile) |
void |
registerInstance(Class<?> registrationClass,
Object instanceObj,
boolean overwrite)
Register an actual instance for an internal Openbravo class (the registrationClass).
|
void |
removeInstance(Class<?> clz)
Removes the singleton instance of the clz (if any) from the internal registry.
|
static void |
setInstance(OBProvider instance) |
public static final String CONFIG_FILE_NAME
public static OBProvider getInstance()
public static void setInstance(OBProvider instance)
public boolean isRegistered(Class<?> clz)
clz - the name of this class is used to check if it is already registeredpublic boolean isRegistered(String name)
name - is used to search the registryprotected void register(String prefix, InputStream is)
public void registerInstance(Class<?> registrationClass, Object instanceObj, boolean overwrite)
registrationClass - the original Openbravo classinstanceObj - the instance to use when the class is requested.overwrite - true overwrite a current registration, false a current registration is not overwrittenpublic void register(Class<?> registrationClass, Class<?> instanceClass, boolean overwrite)
registrationClass - the original Openbravo classinstanceClass - the implementation classoverwrite - true overwrite a current registration, false a current registration is not overwrittenpublic void register(String name, Class<?> instanceClass, boolean overwrite)
name - the name of the Openbravo class or serviceinstanceClass - the implementation classoverwrite - true overwrite a current registration, false a current registration is not overwrittenpublic <T> T get(Class<T> clz)
clz - the class for which an instance is requestedpublic void removeInstance(Class<?> clz)
clz - the instance of this class is removed.public Object get(String name)
name - the name of the serviceOBProviderException