Package org.openhab.core.transform
Class ManagedTransformationProvider
java.lang.Object
org.openhab.core.common.registry.AbstractProvider<Transformation>
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
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
Fields inherited from class org.openhab.core.common.registry.AbstractManagedProvider
loggerFields inherited from class org.openhab.core.common.registry.AbstractProvider
listeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Transformation element) Adds an element.protected StringReturns the name of storage, that is used to persist the elements.protected StringkeyToString(String key) Transforms the key into a string representation.protected @Nullable TransformationtoElement(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 Transformationupdate(Transformation element) Updates an element.Methods inherited from class org.openhab.core.common.registry.AbstractManagedProvider
get, getAll, removeMethods inherited from class org.openhab.core.common.registry.AbstractProvider
addProviderChangeListener, notifyListenersAboutAddedElement, notifyListenersAboutRemovedElement, notifyListenersAboutUpdatedElement, removeProviderChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.common.registry.Provider
addProviderChangeListener, getAll, removeProviderChangeListener
-
Constructor Details
-
ManagedTransformationProvider
-
-
Method Details
-
getStorageName
Description copied from class:AbstractManagedProviderReturns the name of storage, that is used to persist the elements.- Specified by:
getStorageNamein classAbstractManagedProvider<Transformation,String, ManagedTransformationProvider.PersistedTransformation> - Returns:
- name of the storage
-
keyToString
Description copied from class:AbstractManagedProviderTransforms the key into a string representation.- Specified by:
keyToStringin 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:AbstractManagedProviderConverts the persistable element into the original element.- Specified by:
toElementin classAbstractManagedProvider<Transformation,String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
key- keypersistableElement- persistable element- Returns:
- original element
-
toPersistableElement
protected ManagedTransformationProvider.PersistedTransformation toPersistableElement(Transformation element) Description copied from class:AbstractManagedProviderConverts the original element into an element that can be persisted.- Specified by:
toPersistableElementin classAbstractManagedProvider<Transformation,String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
element- original element- Returns:
- persistable element
-
add
Description copied from interface:ManagedProviderAdds an element.- Specified by:
addin interfaceManagedProvider<Transformation,String> - Overrides:
addin classAbstractManagedProvider<Transformation,String, ManagedTransformationProvider.PersistedTransformation> - Parameters:
element- element to be added
-
update
Description copied from interface:ManagedProviderUpdates an element.- Specified by:
updatein interfaceManagedProvider<Transformation,String> - Overrides:
updatein 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
-