Record Class DoubleValue
java.lang.Object
java.lang.Record
com.github.siroshun09.configapi.core.node.DoubleValue
- Record Components:
doubleValue- a double value
- All Implemented Interfaces:
Node<Number>,NumberValue,StringRepresentable,ValueNode<Number>,Comparable<NumberValue>
public record DoubleValue(double doubleValue)
extends Record
implements NumberValue, StringRepresentable
A
Node implementation that holds a double value.-
Field Summary
Fields inherited from interface com.github.siroshun09.configapi.core.node.NumberValue
ZERO -
Constructor Summary
ConstructorsConstructorDescriptionDoubleValue(double doubleValue) Creates an instance of aDoubleValuerecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull VisitResultaccept(@NotNull NodeVisitor visitor) Accepts aNodeVisitorfor thisNode.byteasByte()Gets the number as byte.doubleasDouble()Gets the number as double.floatasFloat()Gets the number as float.intasInt()Gets the number as int.longasLong()Gets the number as long.shortasShort()Gets the number as short.@NotNull StringasString()Represents as aString.intcompareTo(@NotNull NumberValue o) doubleReturns the value of thedoubleValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.@NotNull Doublevalue()Gets an object which thisNodeholdsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.siroshun09.configapi.core.node.Node
asOptionalMethods inherited from interface com.github.siroshun09.configapi.core.node.NumberValue
hasValue
-
Constructor Details
-
DoubleValue
public DoubleValue(double doubleValue) Creates an instance of aDoubleValuerecord class.- Parameters:
doubleValue- the value for thedoubleValuerecord component
-
-
Method Details
-
value
Description copied from interface:NodeGets an object which thisNodeholds -
asInt
public int asInt()Description copied from interface:NumberValueGets the number as int.- Specified by:
asIntin interfaceNumberValue- Returns:
- the int value
-
asLong
public long asLong()Description copied from interface:NumberValueGets the number as long.- Specified by:
asLongin interfaceNumberValue- Returns:
- the long value
-
asFloat
public float asFloat()Description copied from interface:NumberValueGets the number as float.- Specified by:
asFloatin interfaceNumberValue- Returns:
- the float value
-
asDouble
public double asDouble()Description copied from interface:NumberValueGets the number as double.- Specified by:
asDoublein interfaceNumberValue- Returns:
- the double value
-
asByte
public byte asByte()Description copied from interface:NumberValueGets the number as byte.- Specified by:
asBytein interfaceNumberValue- Returns:
- the byte value
-
asShort
public short asShort()Description copied from interface:NumberValueGets the number as short.- Specified by:
asShortin interfaceNumberValue- Returns:
- the short value
-
compareTo
- Specified by:
compareToin interfaceComparable<NumberValue>
-
accept
Description copied from interface:NodeAccepts aNodeVisitorfor thisNode.- Specified by:
acceptin interfaceNode<Number>- Parameters:
visitor- aNodeVisitorto accept- Returns:
- a
VisitResult
-
asString
Description copied from interface:StringRepresentableRepresents as aString.- Specified by:
asStringin interfaceStringRepresentable- Returns:
- a
Stringrepresentation 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 '=='. -
doubleValue
public double doubleValue()Returns the value of thedoubleValuerecord component.- Returns:
- the value of the
doubleValuerecord component
-