Record Class ShortValue
java.lang.Object
java.lang.Record
com.github.siroshun09.configapi.core.node.ShortValue
- Record Components:
shortValue
- a short value
- All Implemented Interfaces:
Node<Number>
,NumberValue
,StringRepresentable
,ValueNode<Number>
,Comparable<NumberValue>
public record ShortValue(short shortValue)
extends Record
implements NumberValue, StringRepresentable
A
Node
implementation that holds a short value.-
Field Summary
Fields inherited from interface com.github.siroshun09.configapi.core.node.NumberValue
ZERO
-
Constructor Summary
ConstructorDescriptionShortValue
(short shortValue) Creates an instance of aShortValue
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull VisitResult
accept
(@NotNull NodeVisitor visitor) Accepts aNodeVisitor
for thisNode
.byte
asByte()
Gets the number as byte.double
asDouble()
Gets the number as double.float
asFloat()
Gets the number as float.int
asInt()
Gets the number as int.long
asLong()
Gets the number as long.short
asShort()
Gets the number as short.@NotNull String
asString()
Represents as aString
.int
compareTo
(@NotNull NumberValue o) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.short
Returns the value of theshortValue
record component.final String
toString()
Returns a string representation of this record class.@NotNull Short
value()
Gets an object which thisNode
holdsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.siroshun09.configapi.core.node.Node
asOptional
Methods inherited from interface com.github.siroshun09.configapi.core.node.NumberValue
hasValue
-
Constructor Details
-
ShortValue
public ShortValue(short shortValue) Creates an instance of aShortValue
record class.- Parameters:
shortValue
- the value for theshortValue
record component
-
-
Method Details
-
value
Description copied from interface:Node
Gets an object which thisNode
holds -
asInt
public int asInt()Description copied from interface:NumberValue
Gets the number as int.- Specified by:
asInt
in interfaceNumberValue
- Returns:
- the int value
-
asLong
public long asLong()Description copied from interface:NumberValue
Gets the number as long.- Specified by:
asLong
in interfaceNumberValue
- Returns:
- the long value
-
asFloat
public float asFloat()Description copied from interface:NumberValue
Gets the number as float.- Specified by:
asFloat
in interfaceNumberValue
- Returns:
- the float value
-
asDouble
public double asDouble()Description copied from interface:NumberValue
Gets the number as double.- Specified by:
asDouble
in interfaceNumberValue
- Returns:
- the double value
-
asByte
public byte asByte()Description copied from interface:NumberValue
Gets the number as byte.- Specified by:
asByte
in interfaceNumberValue
- Returns:
- the byte value
-
asShort
public short asShort()Description copied from interface:NumberValue
Gets the number as short.- Specified by:
asShort
in interfaceNumberValue
- Returns:
- the short value
-
compareTo
- Specified by:
compareTo
in interfaceComparable<NumberValue>
-
accept
Description copied from interface:Node
Accepts aNodeVisitor
for thisNode
.- Specified by:
accept
in interfaceNode<Number>
- Parameters:
visitor
- aNodeVisitor
to accept- Returns:
- a
VisitResult
-
asString
Description copied from interface:StringRepresentable
Represents as aString
.- Specified by:
asString
in interfaceStringRepresentable
- Returns:
- a
String
representation of this node
-
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 with '=='. -
shortValue
public short shortValue()Returns the value of theshortValue
record component.- Returns:
- the value of the
shortValue
record component
-