Interface Numberlike
- All Superinterfaces:
Zeroable
An object implementing this interface is marked as being number-like for the purpose of indexing arguments, using the
',' operator, or indexing callers, using the ':' operator. When either operator is used while pointing towards
an instance,
getInt()
is called. Additionally, instances can be unboxed to any primitive type.-
Method Summary
Modifier and TypeMethodDescriptiondefault byte
getByte()
Gets a byte representation of the object.default char
getChar()
Gets a char representation of the object.default double
Gets a double representation of the object.default float
getFloat()
Gets a float representation of the object.int
getInt()
Gets an integer representation of the object.default long
getLong()
Gets a long representation of the object.default short
getShort()
Gets a short representation of the object.default boolean
isZero()
Called when the '[' or ']' operators are used while pointing towards the instance, or when the instance is unboxed into a boolean value.
-
Method Details
-
getInt
int getInt()Gets an integer representation of the object.- Returns:
- an integer representation of the object to be used for indexing or unboxing.
-
getShort
default short getShort()Gets a short representation of the object.- Returns:
- a short representation of the object to be used for unboxing.
-
getByte
default byte getByte()Gets a byte representation of the object.- Returns:
- a byte representation of the object to be used for unboxing.
-
getChar
default char getChar()Gets a char representation of the object.- Returns:
- a char representation of the object to be used for unboxing.
-
getLong
default long getLong()Gets a long representation of the object.- Returns:
- a long representation of the object to be used for unboxing.
-
getFloat
default float getFloat()Gets a float representation of the object.- Returns:
- a float representation of the object to be used for unboxing.
-
getDouble
default double getDouble()Gets a double representation of the object.- Returns:
- a double representation of the object to be used for unboxing.
-
isZero
default boolean isZero()Description copied from interface:Zeroable
Called when the '[' or ']' operators are used while pointing towards the instance, or when the instance is unboxed into a boolean value.
-