Class AbstractDoc<T>
- All Implemented Interfaces:
Doc
- Direct Known Subclasses:
EnumDoc
,OpenemsTypeDoc
Channel
using Builder pattern.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessMode
(AccessMode accessMode) Sets theAccessMode
for the Channel.abstract <C extends Channel<?>>
CcreateChannelInstance
(OpenemsComponent component, ChannelId channelId) Creates an instance ofChannel
for the given Channel-ID using its Channel-AbstractDoc
.debug()
Activates the more verbose debug mode.Gets the 'Access-Mode' information.Gets the initial value.Gets the callbacks for initialization of the actual Channel.Gets the Persistence Priority.getText()
Gets the descriptive text.getType()
Gets the OpenemsType.getUnit()
Gets the Unit.initialValue
(T initialValue) Initial-Value.boolean
isDebug()
Is the more verbose debug mode activated?.<COMPONENT extends OpenemsComponent>
AbstractDoc<T>onChannelChange
(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel onChange event.<COMPONENT extends OpenemsComponent>
AbstractDoc<T>onChannelChange
(Consumer<COMPONENT> callback) Provides a callback on Channel onChange event.<COMPONENT extends OpenemsComponent>
AbstractDoc<T>onChannelSetNextValue
(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel setNextValue event.<COMPONENT extends OpenemsComponent>
AbstractDoc<T>onChannelSetNextWrite
(ThrowingBiConsumer<COMPONENT, T, OpenemsError.OpenemsNamedException> callback) Provides a callback on Channel setNextWriteValue event.onChannelSetNextWriteMirrorToDebugChannel
(ChannelId targetChannelId) Registers a Mirror-To-Debug-Channel on Channel setNextWriteValue event.<COMPONENT extends OpenemsComponent>
AbstractDoc<T>onChannelUpdate
(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel onUpdate event.Provides a callback on initialization of the actual Channel.persistencePriority
(PersistencePriority persistencePriority) Sets thePersistencePriority
.protected abstract AbstractDoc<T>
self()
Gets an instance of the correct subclass of myself.Sets the descriptive text.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.edge.common.channel.Doc
getChannelCategory
-
Constructor Details
-
AbstractDoc
-
-
Method Details
-
self
Gets an instance of the correct subclass of myself.- Returns:
- myself
-
getType
Description copied from interface:Doc
Gets the OpenemsType. -
accessMode
Sets theAccessMode
for the Channel.This is validated on construction of the Channel by
AbstractReadChannel
- Parameters:
accessMode
- theAccessMode
- Returns:
- myself
-
getAccessMode
Description copied from interface:Doc
Gets the 'Access-Mode' information.- Specified by:
getAccessMode
in interfaceDoc
- Returns:
- the
AccessMode
-
persistencePriority
Sets thePersistencePriority
. Defaults toPersistencePriority.VERY_LOW
.This parameter may be used by persistence services to decide, if the Channel should be persisted to the hard disk.
- Parameters:
persistencePriority
- thePersistencePriority
- Returns:
- myself
-
getPersistencePriority
Description copied from interface:Doc
Gets the Persistence Priority. Defaults to VERY_LOW.This parameter may be used by persistence services to decide, if the Channel should be persisted to the hard disk.
- Specified by:
getPersistencePriority
in interfaceDoc
- Returns:
- the
PersistencePriority
-
initialValue
Initial-Value. Default: none- Parameters:
initialValue
- the initial value- Returns:
- myself
-
getInitialValue
Gets the initial value.- Returns:
- the initial value
-
text
Description copied from interface:Doc
Sets the descriptive text. Defaults to an empty string. -
getText
Description copied from interface:Doc
Gets the descriptive text. Defaults to empty String. -
getUnit
Description copied from interface:Doc
Gets the Unit. Defaults to NONE. -
debug
Activates the more verbose debug mode.- Returns:
- myself
-
isDebug
public boolean isDebug()Description copied from interface:Doc
Is the more verbose debug mode activated?. -
onInit
Provides a callback on initialization of the actual Channel.- Parameters:
callback
- the method to call on initialization- Returns:
- myself
-
onChannelChange
public <COMPONENT extends OpenemsComponent> AbstractDoc<T> onChannelChange(Consumer<COMPONENT> callback) Provides a callback on Channel onChange event.This is a convenience method to react on a
Channel.onChange(BiConsumer)
event- Type Parameters:
COMPONENT
- the type of theOpenemsComponent
- Parameters:
callback
- the callback method- Returns:
- myself
-
onChannelChange
public <COMPONENT extends OpenemsComponent> AbstractDoc<T> onChannelChange(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel onChange event.This is a convenience method to react on a
Channel.onChange(BiConsumer)
event- Type Parameters:
COMPONENT
- the type of theOpenemsComponent
- Parameters:
callback
- the callback method; value is the new value after change- Returns:
- myself
-
onChannelUpdate
public <COMPONENT extends OpenemsComponent> AbstractDoc<T> onChannelUpdate(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel onUpdate event.This is a convenience method to react on a
Channel.onUpdate(Consumer)
event- Type Parameters:
COMPONENT
- the type of theOpenemsComponent
- Parameters:
callback
- the callback method- Returns:
- myself
-
onChannelSetNextValue
public <COMPONENT extends OpenemsComponent> AbstractDoc<T> onChannelSetNextValue(BiConsumer<COMPONENT, Value<T>> callback) Provides a callback on Channel setNextValue event.This is a convenience method to react on a
Channel.onSetNextValue(Consumer)
event- Type Parameters:
COMPONENT
- the type of theOpenemsComponent
- Parameters:
callback
- the callback method; value is the new value after change- Returns:
- myself
-
onChannelSetNextWrite
public <COMPONENT extends OpenemsComponent> AbstractDoc<T> onChannelSetNextWrite(ThrowingBiConsumer<COMPONENT, T, OpenemsError.OpenemsNamedException> callback) Provides a callback on Channel setNextWriteValue event.This is a convenience method to react on a
WriteChannel.onSetNextWrite(ThrowingConsumer)
event- Type Parameters:
COMPONENT
- the type of theOpenemsComponent
- Parameters:
callback
- the callback method; value can be null- Returns:
- myself
-
onChannelSetNextWriteMirrorToDebugChannel
Registers a Mirror-To-Debug-Channel on Channel setNextWriteValue event.After calling this method, on every setNextWriteValue event, the 'nextWriteValue' will be mirrored to the 'targetChannelId' of the same Component.
- Parameters:
targetChannelId
- the target Channel-ID of the same component- Returns:
- myself
-
getOnInitCallbacks
Gets the callbacks for initialization of the actual Channel.- Returns:
- a list of callbacks
-
createChannelInstance
public abstract <C extends Channel<?>> C createChannelInstance(OpenemsComponent component, ChannelId channelId) Creates an instance ofChannel
for the given Channel-ID using its Channel-AbstractDoc
.- Specified by:
createChannelInstance
in interfaceDoc
- Type Parameters:
C
- theChannel
type- Parameters:
component
- theOpenemsComponent
channelId
- theChannelId
- Returns:
- the Channel
-