public class FactoryGlobal<ABSTRACTCLASS,IDENTIFIER>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
FactoryGlobal.FactoryEntry
Class for creation/destruction interface management
|
static class |
FactoryGlobal.ReturnCode
Return code
|
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<IDENTIFIER,FactoryGlobal.FactoryEntry> |
m_creators
Map of FactoryEntry
|
protected RtcDeleteFunc |
m_Delete
Interface for component destruction variable
|
protected RtcNewFunc |
m_New
Interface for component creation variable
|
protected NumberingPolicy |
m_policy
Class for numbering policy (naming policy) management.
|
Modifier | Constructor and Description |
---|---|
protected |
FactoryGlobal()
FactoryGlobal constructor
|
Modifier and Type | Method and Description |
---|---|
FactoryGlobal.ReturnCode |
addFactory(IDENTIFIER id,
ObjectCreator creator,
ObjectDestructor destructor)
Resters Factory to the map.
|
java.util.ArrayList<ABSTRACTCLASS> |
createdObjects()
Getting created objects
|
ABSTRACTCLASS |
createObject(IDENTIFIER id)
Object generation processing
|
FactoryGlobal.ReturnCode |
deleteObject(ABSTRACTCLASS obj)
Deletes the object.
This method deletes specified Object.
with identifier.}
|
FactoryGlobal.ReturnCode |
deleteObject(IDENTIFIER id,
ABSTRACTCLASS obj)
Deletes the object.
|
java.util.Set<IDENTIFIER> |
getIdentifiers()
Returns Identifiers of the map.
|
boolean |
hasFactory(IDENTIFIER id)
Checks whether Identifier exists in the map.
|
static FactoryGlobal |
instance()
Creates FactoryGlobal.
|
static java.lang.Object |
instance(java.lang.String clazz)
Creates FactoryGlobal.
|
boolean |
isProducerOf(ABSTRACTCLASS obj)
Whether a object is a product of this factory
|
ObjectCreator |
objectToCreator(ABSTRACTCLASS obj)
Getting destructor of the object
|
ObjectDestructor |
objectToDestructor(ABSTRACTCLASS obj)
Getting destructor of the object
|
FactoryGlobal.ReturnCode |
objectToIdentifier(ABSTRACTCLASS obj,
IDENTIFIER id)
Getting class identifier (ID) from a object
|
FactoryGlobal.ReturnCode |
removeFactory(IDENTIFIER id)
Removes Factory from the map.
|
protected RtcNewFunc m_New
protected RtcDeleteFunc m_Delete
protected NumberingPolicy m_policy
protected java.util.HashMap<IDENTIFIER,FactoryGlobal.FactoryEntry> m_creators
public static FactoryGlobal instance()
public static java.lang.Object instance(java.lang.String clazz)
clazz
-
class namepublic boolean hasFactory(IDENTIFIER id)
id
-
Identifierpublic java.util.Set<IDENTIFIER> getIdentifiers()
public FactoryGlobal.ReturnCode addFactory(IDENTIFIER id, ObjectCreator creator, ObjectDestructor destructor)
id
- Identifiercreator
- creation functiondestructor
- destruction functionpublic FactoryGlobal.ReturnCode removeFactory(IDENTIFIER id)
id
-
Identifierpublic ABSTRACTCLASS createObject(IDENTIFIER id)
This method creates the object with factory specified with identifier.
id
-
Identifier of created objectpublic FactoryGlobal.ReturnCode deleteObject(IDENTIFIER id, ABSTRACTCLASS obj)
This method deletes the object with factory specified with identifier.
id
-
Identifier of deleted objectobj
-
Deleteed object.public FactoryGlobal.ReturnCode deleteObject(ABSTRACTCLASS obj)
obj
-
Deleteed object.public java.util.ArrayList<ABSTRACTCLASS> createdObjects()
This operation returns a list of created objects by the factory.
public boolean isProducerOf(ABSTRACTCLASS obj)
obj
-
A target objectpublic FactoryGlobal.ReturnCode objectToIdentifier(ABSTRACTCLASS obj, IDENTIFIER id)
This operation returns a class identifier (ID) from a object.
obj
- [in]
An object to investigate its class ID.id
- [out]
Class identifier (ID)public ObjectCreator objectToCreator(ABSTRACTCLASS obj)
This operation returns a constructor of the object created by the factory. obj must be a product of the factory. User must check if the object is a product of the factory by using isProducerOf()-function, before using this function.
public ObjectDestructor objectToDestructor(ABSTRACTCLASS obj)
This operation returns a destructor of the object created by the factory. obj must be a product of the factory. User must check if the object is a product of the factory by using isProducerOf()-function, before using this function.