Package org.openhab.core.transform
Class ManagedTransformationProvider
java.lang.Object
org.openhab.core.common.registry.AbstractProvider<E>
org.openhab.core.common.registry.AbstractManagedProvider<Transformation,String,ManagedTransformationProvider.PersistedTransformation>
org.openhab.core.transform.ManagedTransformationProvider
- All Implemented Interfaces:
ManagedProvider<Transformation,
,String> Provider<Transformation>
,TransformationProvider
@NonNullByDefault
public class ManagedTransformationProvider
extends AbstractManagedProvider<Transformation,String,ManagedTransformationProvider.PersistedTransformation>
implements TransformationProvider
The
ManagedTransformationProvider
implements a TransformationProvider
for
managed transformations stored in a JSON database- Author:
- Jan N. Klug - Initial contribution
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Fields inherited from class org.openhab.core.common.registry.AbstractManagedProvider
logger
Fields inherited from class org.openhab.core.common.registry.AbstractProvider
listeners
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Transformation element) Adds an element.protected String
Returns the name of storage, that is used to persist the elements.protected String
keyToString
(String key) Transforms the key into a string representation.protected @Nullable Transformation
toElement
(String key, ManagedTransformationProvider.PersistedTransformation persistableElement) Converts the persistable element into the original element.toPersistableElement
(Transformation element) Converts the original element into an element that can be persisted.@Nullable Transformation
update
(Transformation element) Updates an element.Methods inherited from class org.openhab.core.common.registry.AbstractManagedProvider
get, getAll, remove
Methods inherited from class org.openhab.core.common.registry.AbstractProvider
addProviderChangeListener, notifyListenersAboutAddedElement, notifyListenersAboutRemovedElement, notifyListenersAboutUpdatedElement, removeProviderChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.common.registry.Provider
addProviderChangeListener, getAll, removeProviderChangeListener
-
Constructor Details
-
ManagedTransformationProvider
-
-
Method Details
-
getStorageName
Description copied from class:AbstractManagedProvider
Returns the name of storage, that is used to persist the elements.- Specified by:
getStorageName
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Returns:
- name of the storage
-
keyToString
Description copied from class:AbstractManagedProvider
Transforms the key into a string representation.- Specified by:
keyToString
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
key
- key- Returns:
- string representation of the key
-
toElement
protected @Nullable Transformation toElement(String key, ManagedTransformationProvider.PersistedTransformation persistableElement) Description copied from class:AbstractManagedProvider
Converts the persistable element into the original element.- Specified by:
toElement
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
key
- keypersistableElement
- persistable element- Returns:
- original element
-
toPersistableElement
protected ManagedTransformationProvider.PersistedTransformation toPersistableElement(Transformation element) Description copied from class:AbstractManagedProvider
Converts the original element into an element that can be persisted.- Specified by:
toPersistableElement
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
element
- original element- Returns:
- persistable element
-
add
Description copied from interface:ManagedProvider
Adds an element.- Specified by:
add
in interfaceManagedProvider<Transformation,
String> - Overrides:
add
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
element
- element to be added
-
update
Description copied from interface:ManagedProvider
Updates an element.- Specified by:
update
in interfaceManagedProvider<Transformation,
String> - Overrides:
update
in classAbstractManagedProvider<Transformation,
String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
element
- element to be updated- Returns:
- returns the old element or null if no element with the same key exists
-