Package io.openems.edge.common.channel
Record Class ChannelId.ChannelIdImpl
java.lang.Object
java.lang.Record
io.openems.edge.common.channel.ChannelId.ChannelIdImpl
- All Implemented Interfaces:
ChannelId
- Enclosing interface:
- ChannelId
public static record ChannelId.ChannelIdImpl(String name, Doc doc)
extends Record
implements ChannelId
The preferred way to define
ChannelId
s in OpenEMS Edge is via an
enum
that inherits ChannelId
:
public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
MY_CHANNEL(Doc.of(OpenemsType.INTEGER));
private final Doc doc;
private ChannelId(Doc doc) {
this.doc = doc;
}
@Override
public Doc doc() {
return this.doc;
}
}
If instead you need to dynamically create ChannelIds at runtime - e.g.
because at compile time you do not know the exact number of battery modules
of a battery system - you may use ChannelId.ChannelIdImpl
manually.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openems.edge.common.channel.ChannelId
ChannelId.ChannelIdImpl
-
Constructor Summary
ConstructorsConstructorDescriptionChannelIdImpl
(String name, Doc doc) Creates an instance of aChannelIdImpl
record class. -
Method Summary
Modifier and TypeMethodDescriptiondoc()
Returns the value of thedoc
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ChannelIdImpl
Creates an instance of aChannelIdImpl
record class.- Parameters:
name
- the value for thename
record componentdoc
- the value for thedoc
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
name
Returns the value of thename
record component. -
doc
Returns the value of thedoc
record component.
-