public class CommonItemFactory extends Object implements ItemFactory
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_ID_DELIMITER |
protected Map<String,DataItem> |
itemMap |
Constructor and Description |
---|
CommonItemFactory(Executor executor) |
CommonItemFactory(Executor executor,
CommonItemFactory parentItemFactory,
String baseId,
String idDelimiter) |
Modifier and Type | Method and Description |
---|---|
boolean |
addSubFactory(ItemFactory itemFactory) |
protected DataItemCommand |
constructCommand(String localId) |
protected DataItemInputChained |
constructInput(String localId) |
protected WriteHandlerItem |
constructInputOutput(String localId,
WriteHandler writeHandler) |
protected WriteHandlerItem |
constructWriteHandler(String localId,
WriteHandler writeHandler) |
DataItemCommand |
createCommand(String localId,
Map<String,Variant> properties) |
DataItemInputChained |
createInput(String localId,
Map<String,Variant> properties) |
WriteHandlerItem |
createInputOutput(String localId,
Map<String,Variant> properties,
WriteHandler writeHandler) |
WriteHandlerItem |
createOutput(String localId,
Map<String,Variant> properties,
WriteHandler writeHandler) |
void |
dispose()
Dispose the factory
|
void |
disposeAllItems()
Dispose all items but not the factory itself
|
void |
disposeItem(DataItem item)
Dispose an item if it was created by this factory
|
protected String |
generateId(String localId)
Generate a global Id by using the base id and the local id
|
String |
getBaseId() |
boolean |
isDisposed() |
boolean |
removeSubFactory(ItemFactory itemFactory) |
void |
setIdDelimiter(String idDelimiter)
Change the ID delimiter.
|
protected static final String DEFAULT_ID_DELIMITER
public CommonItemFactory(Executor executor)
public CommonItemFactory(Executor executor, CommonItemFactory parentItemFactory, String baseId, String idDelimiter)
public void setIdDelimiter(String idDelimiter)
Note that items which have already been created will not but updated to use the new delimiter
idDelimiter
- the new delimiter to usepublic boolean isDisposed()
protected String generateId(String localId)
localId
- the local idprotected DataItemCommand constructCommand(String localId)
protected DataItemInputChained constructInput(String localId)
protected WriteHandlerItem constructInputOutput(String localId, WriteHandler writeHandler)
protected WriteHandlerItem constructWriteHandler(String localId, WriteHandler writeHandler)
public void dispose()
ItemFactory
All items that where created by this factory and where not disposed up to now are being disposed
After a call to this method it is not possible to create new items.
Multiple calls to ItemFactory.dispose()
or calls to
ItemFactory.disposeAllItems()
are possible.
dispose
in interface ItemFactory
public void disposeAllItems()
disposeAllItems
in interface ItemFactory
public void disposeItem(DataItem item)
ItemFactory
If the item was not created by this factory or was already disposed this is no error and no exception is thrown
disposeItem
in interface ItemFactory
item
- data item to disposepublic DataItemCommand createCommand(String localId, Map<String,Variant> properties)
createCommand
in interface ItemFactory
public DataItemInputChained createInput(String localId, Map<String,Variant> properties)
createInput
in interface ItemFactory
public WriteHandlerItem createOutput(String localId, Map<String,Variant> properties, WriteHandler writeHandler)
createOutput
in interface ItemFactory
public WriteHandlerItem createInputOutput(String localId, Map<String,Variant> properties, WriteHandler writeHandler)
createInputOutput
in interface ItemFactory
public String getBaseId()
public boolean addSubFactory(ItemFactory itemFactory)
public boolean removeSubFactory(ItemFactory itemFactory)