Class Uint8
java.lang.Object
java.lang.Number
org.opendaylight.yangtools.yang.common.Uint8
- All Implemented Interfaces:
Serializable,Comparable<Uint8>,Immutable,CanonicalValue<Uint8>
Dedicated type for YANG's
type uint8 type.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal bytefinal intfinal doublefinal booleanfinal booleanA slightly faster version ofequals(Object).final floatstatic Uint8fromByteBits(byte bits) Returns anUint8corresponding to a given bit representation.final inthashCode()final intintValue()final longstatic Uint8saturatedOf(byte byteVal) Returns anUint8corresponding to a givenbyteValif it is representable.static Uint8saturatedOf(int intVal) Returns anUint8corresponding to a givenintValif it is representable.static Uint8saturatedOf(long longVal) Returns anUint8corresponding to a givenlongValif it is representable.static Uint8saturatedOf(short shortVal) Returns anUint8corresponding to a givenshortValif it is representable.final CanonicalValueSupport<Uint8>support()Return theCanonicalValueassociated with this type.final StringReturn the canonical string representation of this value.final shorttoJava()Convert this value to ashort.final StringtoString()final Uint16toUint16()Convert this value to aUint16.final Uint32toUint32()Convert this value to aUint32.final Uint64toUint64()Convert this value to aUint64.static Uint8valueOf(byte byteVal) Returns anUint8corresponding to a givenbyteVal.static Uint8valueOf(int intVal) Returns anUint8corresponding to a givenintVal.static Uint8valueOf(long longVal) Returns anUint8corresponding to a givenlongVal.static Uint8valueOf(short shortVal) Returns anUint8corresponding to a givenshortVal.static Uint8Returns anUint8holding the value of the specifiedString, parsed as an unsignedshortvalue.static Uint8Returns anUint8holding the value of the specifiedString, parsed as an unsignedshortvalue.static Uint8Returns anUint8corresponding to a givenuint.static Uint8Returns anUint8corresponding to a givenuint.static Uint8Returns anUint8corresponding to a givenuint.Methods inherited from class java.lang.Number
shortValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opendaylight.yangtools.yang.common.CanonicalValue
validator
-
Field Details
-
ZERO
Value of0. -
ONE
Value of1. -
TWO
Value of2. -
TEN
Value of10. -
MAX_VALUE
Value of255.
-
-
Constructor Details
-
Uint8
-
-
Method Details
-
fromByteBits
Returns anUint8corresponding 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
- Parameters:
byteVal- byte value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException- if byteVal is less than zero
-
valueOf
- Parameters:
shortVal- short value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException- if shortVal is less than zero or greater than 255.
-
valueOf
- Parameters:
intVal- int value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException- if intVal is less than zero or greater than 255.
-
valueOf
- Parameters:
longVal- long value- Returns:
- A Uint8 instance
- Throws:
IllegalArgumentException- if intVal is less than zero or greater than 255.
-
valueOf
Returns anUint8corresponding to a givenuint.- Parameters:
uint- Uint16 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException- if uint is nullIllegalArgumentException- if uint is greater than 255.
-
valueOf
Returns anUint8corresponding to a givenuint.- Parameters:
uint- Uint32 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException- if uint is nullIllegalArgumentException- if uint is greater than 255.
-
valueOf
Returns anUint8corresponding to a givenuint.- Parameters:
uint- Uint64 value- Returns:
- A Uint8 instance
- Throws:
NullPointerException- if uint is nullIllegalArgumentException- if uint is greater than 255.
-
valueOf
Returns anUint8holding the value of the specifiedString, parsed as an unsignedshortvalue.- 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 unsignedshortvalue.
-
valueOf
Returns anUint8holding the value of the specifiedString, parsed as an unsignedshortvalue.- 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 unsignedshortvalue, or if theradixis outside of allowed range.
-
saturatedOf
Returns anUint8corresponding to a givenbyteValif it is representable. If the value is negativeZEROwill be returned.- Parameters:
byteVal- byte value- Returns:
- A Uint8 instance
-
saturatedOf
Returns anUint8corresponding to a givenshortValif it is representable. If the value is negativeZEROwill be returned. If the value is greater than 255,MAX_VALUEwill be returned.- Parameters:
shortVal- short value- Returns:
- A Uint8 instance
-
saturatedOf
Returns anUint8corresponding to a givenintValif it is representable. If the value is negativeZEROwill be returned. If the value is greater than 255,MAX_VALUEwill be returned.- Parameters:
intVal- int value- Returns:
- A Uint8 instance
-
saturatedOf
Returns anUint8corresponding to a givenlongValif it is representable. If the value is negativeZEROwill be returned. If the value is greater than 255,MAX_VALUEwill be returned.- Parameters:
longVal- long value- Returns:
- A Uint8 instance
-
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. -
intValue
public final int intValue() -
longValue
public final long longValue() -
floatValue
public final float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public final double doubleValue()- Specified by:
doubleValuein classNumber
-
compareTo
- Specified by:
compareToin interfaceComparable<Uint8>
-
toCanonicalString
Description copied from interface:CanonicalValueReturn the canonical string representation of this value.- Specified by:
toCanonicalStringin interfaceCanonicalValue<Uint8>- Returns:
- Canonical string
-
support
Description copied from interface:CanonicalValueReturn theCanonicalValueassociated with this type. It can be used to create new instances of this representation.- Specified by:
supportin interfaceCanonicalValue<Uint8>- Returns:
- A
CanonicalValueinstance.
-
toJava
public final short toJava()Convert this value to ashort.- Returns:
- A short
-
toUint16
Convert this value to aUint16.- Returns:
- A Uint16
-
toUint32
Convert this value to aUint32.- Returns:
- A Uint32
-
toUint64
Convert this value to aUint64.- Returns:
- A Uint64
-
hashCode
public final int hashCode() -
equals
-
equals
A slightly faster version ofequals(Object).- Parameters:
obj- Uint8 object- Returns:
trueif this object is the same as the obj argument;falseotherwise.
-
toString
-