Class Uint8
- java.lang.Object
-
- java.lang.Number
-
- org.opendaylight.yangtools.yang.common.Uint8
-
- All Implemented Interfaces:
Serializable
,Comparable<Uint8>
,Immutable
,MutationBehaviour<Immutable>
,CanonicalValue<Uint8>
@Beta @NonNullByDefault public class Uint8 extends Number implements CanonicalValue<Uint8>
Dedicated type for YANG's 'type uint8' type.- Author:
- Robert Varga
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Uint8.Support
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
byteValue()
int
compareTo(Uint8 o)
double
doubleValue()
boolean
equals(@Nullable Object obj)
boolean
equals(@Nullable Uint8 obj)
A slightly faster version ofequals(Object)
.float
floatValue()
static Uint8
fromByteBits(byte bits)
Returns anUint8
corresponding to a given bit representation.int
hashCode()
int
intValue()
long
longValue()
CanonicalValueSupport<Uint8>
support()
Return theCanonicalValue
associated with this type.String
toCanonicalString()
Return the canonical string representation of this value.short
toJava()
Convert this value to ashort
.String
toString()
Uint16
toUint16()
Convert this value to aUint16
.Uint32
toUint32()
Convert this value to aUint32
.Uint64
toUint64()
Convert this value to aUint64
.static Uint8
valueOf(byte byteVal)
Returns anUint8
corresponding to a givenbyteVal
.static Uint8
valueOf(int intVal)
Returns anUint8
corresponding to a givenintVal
.static Uint8
valueOf(long longVal)
Returns anUint8
corresponding to a givenlongVal
.static Uint8
valueOf(short shortVal)
Returns anUint8
corresponding to a givenshortVal
.static Uint8
valueOf(String string)
Returns anUint8
holding the value of the specifiedString
, parsed as an unsignedshort
value.static Uint8
valueOf(String string, int radix)
Returns anUint8
holding the value of the specifiedString
, parsed as an unsignedshort
value.static Uint8
valueOf(Uint16 uint)
Returns anUint8
corresponding to a givenuint
.static Uint8
valueOf(Uint32 uint)
Returns anUint8
corresponding to a givenuint
.static Uint8
valueOf(Uint64 uint)
Returns anUint8
corresponding to a givenuint
.-
Methods inherited from class java.lang.Number
shortValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.common.CanonicalValue
validator
-
-
-
-
Constructor Detail
-
Uint8
protected Uint8(Uint8 other)
-
-
Method Detail
-
fromByteBits
public static Uint8 fromByteBits(byte bits)
Returns anUint8
corresponding to a given bit representation. The argument is interpreted as an unsigned 8-bit value.- Parameters:
bits
- unsigned bit representation- Returns:
- A Uint8 instance
-
valueOf
public static Uint8 valueOf(byte byteVal)
- Parameters:
byteVal
- byte value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException
- if byteVal is less than zero
-
valueOf
public static Uint8 valueOf(short shortVal)
- Parameters:
shortVal
- short value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException
- if shortVal is less than zero or greater than 255.
-
valueOf
public static Uint8 valueOf(int intVal)
- Parameters:
intVal
- int value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException
- if intVal is less than zero or greater than 255.
-
valueOf
public static Uint8 valueOf(long longVal)
- Parameters:
longVal
- long value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException
- if intVal is less than zero or greater than 255.
-
valueOf
public static Uint8 valueOf(Uint16 uint)
Returns anUint8
corresponding to a givenuint
.- Parameters:
uint
- Uint16 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException
- if uint is nullIllegalArgumentException
- if uint is greater than 255.
-
valueOf
public static Uint8 valueOf(Uint32 uint)
Returns anUint8
corresponding to a givenuint
.- Parameters:
uint
- Uint32 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException
- if uint is nullIllegalArgumentException
- if uint is greater than 255.
-
valueOf
public static Uint8 valueOf(Uint64 uint)
Returns anUint8
corresponding to a givenuint
.- Parameters:
uint
- Uint64 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException
- if uint is nullIllegalArgumentException
- if uint is greater than 255.
-
valueOf
public static Uint8 valueOf(String string)
Returns anUint8
holding the value of the specifiedString
, parsed as an unsignedshort
value.- Parameters:
string
- String to parse- Returns:
- A Uint8 instance
- Throws:
NullPointerException
- if string is nullIllegalArgumentException
- if the parsed value is less than zero or greater than 255NumberFormatException
- if the string does not contain a parsable unsignedshort
value.
-
valueOf
public static Uint8 valueOf(String string, int radix)
Returns anUint8
holding the value of the specifiedString
, parsed as an unsignedshort
value.- Parameters:
string
- String to parseradix
- Radix to use- Returns:
- A Uint8 instance
- Throws:
NullPointerException
- if string is nullIllegalArgumentException
- if the parsed value is less than zero or greater than 255NumberFormatException
- if the string does not contain a parsable unsignedshort
value, or if theradix
is outside of allowed range.
-
byteValue
public final byte byteValue()
The inverse operation is
fromByteBits(byte)
. In case this value is greater thanByte.MAX_VALUE
, the returned value will be equal tothis - 2^8
.
-
floatValue
public final float floatValue()
- Specified by:
floatValue
in classNumber
-
doubleValue
public final double doubleValue()
- Specified by:
doubleValue
in classNumber
-
compareTo
public final int compareTo(Uint8 o)
- Specified by:
compareTo
in interfaceComparable<Uint8>
-
toCanonicalString
public final String toCanonicalString()
Description copied from interface:CanonicalValue
Return the canonical string representation of this value.- Specified by:
toCanonicalString
in interfaceCanonicalValue<Uint8>
- Returns:
- Canonical string
-
support
public final CanonicalValueSupport<Uint8> support()
Description copied from interface:CanonicalValue
Return theCanonicalValue
associated with this type. It can be used to create new instances of this representation.- Specified by:
support
in interfaceCanonicalValue<Uint8>
- Returns:
- A
CanonicalValue
instance.
-
toJava
public final short toJava()
Convert this value to ashort
.- Returns:
- A short
-
toUint16
public final Uint16 toUint16()
Convert this value to aUint16
.- Returns:
- A Uint16
-
toUint32
public final Uint32 toUint32()
Convert this value to aUint32
.- Returns:
- A Uint32
-
toUint64
public final Uint64 toUint64()
Convert this value to aUint64
.- Returns:
- A Uint64
-
equals
public final boolean equals(@Nullable Uint8 obj)
A slightly faster version ofequals(Object)
.- Parameters:
obj
- Uint8 object- Returns:
true
if this object is the same as the obj argument;false
otherwise.
-
-