Class AbstractDoc<T>
- java.lang.Object
-
- io.openems.edge.common.channel.internal.AbstractDoc<T>
-
- All Implemented Interfaces:
Doc
- Direct Known Subclasses:
EnumDoc
,OpenemsTypeDoc
public abstract class AbstractDoc<T> extends java.lang.Object implements Doc
Provides static meta information for aChannel
using Builder pattern.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDoc(OpenemsType type)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AbstractDoc<T>
accessMode(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
.AbstractDoc<T>
debug()
Activates the more verbose debug mode.AccessMode
getAccessMode()
Gets the 'Access-Mode' information.T
getInitialValue()
Gets the initial value.protected java.util.List<java.util.function.Consumer<Channel<T>>>
getOnInitCallbacks()
Gets the callbacks for initialization of the actual Channel.PersistencePriority
getPersistencePriority()
Gets the Persistence Priority.java.lang.String
getText()
Gets the descriptive text.OpenemsType
getType()
Gets the OpenemsType.Unit
getUnit()
Gets the Unit.AbstractDoc<T>
initialValue(T initialValue)
Initial-Value.boolean
isDebug()
Is the more verbose debug mode activated?.AbstractDoc<T>
onInit(java.util.function.Consumer<Channel<T>> callback)
Provides a callback on initialization of the actual Channel.AbstractDoc<T>
persistencePriority(PersistencePriority persistencePriority)
Sets thePersistencePriority
.protected abstract AbstractDoc<T>
self()
Gets an instance of the correct subclass of myself.AbstractDoc<T>
text(java.lang.String text)
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 Detail
-
AbstractDoc
protected AbstractDoc(OpenemsType type)
-
-
Method Detail
-
self
protected abstract AbstractDoc<T> self()
Gets an instance of the correct subclass of myself.- Returns:
- myself
-
getType
public OpenemsType getType()
Description copied from interface:Doc
Gets the OpenemsType.
-
accessMode
public AbstractDoc<T> accessMode(AccessMode accessMode)
Sets theAccessMode
for the Channel.This is validated on construction of the Channel by
AbstractReadChannel
- Parameters:
accessMode
- theAccessMode
- Returns:
- myself
-
getAccessMode
public AccessMode getAccessMode()
Description copied from interface:Doc
Gets the 'Access-Mode' information.- Specified by:
getAccessMode
in interfaceDoc
- Returns:
- the
AccessMode
-
persistencePriority
public AbstractDoc<T> persistencePriority(PersistencePriority 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
public PersistencePriority 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
public AbstractDoc<T> initialValue(T initialValue)
Initial-Value. Default: none- Parameters:
initialValue
- the initial value- Returns:
- myself
-
getInitialValue
public T getInitialValue()
Gets the initial value.- Returns:
- the initial value
-
text
public AbstractDoc<T> text(java.lang.String text)
Description copied from interface:Doc
Sets the descriptive text. Defaults to an empty string.
-
getText
public java.lang.String getText()
Description copied from interface:Doc
Gets the descriptive text. Defaults to empty String.
-
getUnit
public Unit getUnit()
Description copied from interface:Doc
Gets the Unit. Defaults to NONE.
-
debug
public AbstractDoc<T> 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
public AbstractDoc<T> onInit(java.util.function.Consumer<Channel<T>> callback)
Provides a callback on initialization of the actual Channel.- Parameters:
callback
- the method to call on initialization- Returns:
- myself
-
getOnInitCallbacks
protected java.util.List<java.util.function.Consumer<Channel<T>>> 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
-
-