Class Uint16
java.lang.Object
java.lang.Number
org.opendaylight.yangtools.yang.common.Uint16
- All Implemented Interfaces:
Serializable,Comparable<Uint16>,Immutable,CanonicalValue<Uint16>
Dedicated type for YANG's
type uint16 type.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal doublefinal booleanfinal booleanA slightly faster version ofequals(Object).final floatstatic Uint16fromShortBits(short bits) Returns anUint16corresponding to a given bit representation.final inthashCode()final Uint16intern()Return an interned (shared) instance equivalent to this object.final intintValue()final longstatic Uint16saturatedOf(byte byteVal) Returns anUint16corresponding to a givenbyteValif it is representable.static Uint16saturatedOf(int intVal) Returns anUint16corresponding to a givenintValif it is representable.static Uint16saturatedOf(long longVal) Returns anUint16corresponding to a givenlongValif it is representable.static Uint16saturatedOf(short shortVal) Returns anUint16corresponding to a givenshortValif it is representable.final shortfinal CanonicalValueSupport<Uint16>support()Return theCanonicalValueassociated with this type.final StringReturn the canonical string representation of this value.final inttoJava()Convert this value to anint.final Uint8final StringtoString()final Uint32toUint32()Convert this value to aUint32.final Uint64toUint64()Convert this value to aUint64.final Uint8toUint8()Convert this value to aUint8.static Uint16valueOf(byte byteVal) Returns anUint16corresponding to a givenbyteVal.static Uint16valueOf(int intVal) Returns anUint16corresponding to a givenintVal.static Uint16valueOf(long longVal) Returns anUint16corresponding to a givenlongVal.static Uint16valueOf(short shortVal) Returns anUint16corresponding to a givenshortVal.static Uint16Returns anUint16holding the value of the specifiedString, parsed as an unsignedintvalue.static Uint16Returns anUint16holding the value of the specifiedString, parsed as an unsignedintvalue.static Uint16Returns anUint8corresponding to a givenuint.static Uint16Returns anUint8corresponding to a givenuint.static Uint16Returns anUint16corresponding to a givenuint.Methods 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 of65535.
-
-
Constructor Details
-
Uint16
-
-
Method Details
-
fromShortBits
Returns anUint16corresponding to a given bit representation. The argument is interpreted as an unsigned 16-bit value.- Parameters:
bits- unsigned bit representation- Returns:
- A Uint16 instance
-
valueOf
- Parameters:
byteVal- byte value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException- if byteVal is less than zero
-
valueOf
- Parameters:
shortVal- short value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException- if shortVal is less than zero.
-
valueOf
- Parameters:
intVal- int value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException- if intVal is less than zero or greater than 65535.
-
valueOf
- Parameters:
longVal- long value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException- if intVal is less than zero or greater than 65535.
-
valueOf
Returns anUint16corresponding to a givenuint.- Parameters:
uint- Uint8 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException- if uint is null
-
valueOf
Returns anUint8corresponding to a givenuint.- Parameters:
uint- Uint32 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException- if uint is nullIllegalArgumentException- if uint is greater than 65535.
-
valueOf
Returns anUint8corresponding to a givenuint.- Parameters:
uint- Uint64 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException- if uint is nullIllegalArgumentException- if uint is greater than 65535.
-
valueOf
Returns anUint16holding the value of the specifiedString, parsed as an unsignedintvalue.- Parameters:
string- String to parse- Returns:
- A Uint16 instance
- Throws:
NullPointerException- if string is nullIllegalArgumentException- if the parsed value is less than zero or greater than 65535NumberFormatException- if the string does not contain a parsable unsignedintvalue.
-
valueOf
Returns anUint16holding the value of the specifiedString, parsed as an unsignedintvalue.- Parameters:
string- String to parseradix- Radix to use- Returns:
- A Uint16 instance
- Throws:
NullPointerException- if string is nullIllegalArgumentException- if the parsed value is less than zero or greater than 65535NumberFormatException- if the string does not contain a parsable unsignedintvalue, or if theradixis outside of allowed range.
-
saturatedOf
Returns anUint16corresponding to a givenbyteValif it is representable. If the value is negativeZEROwill be returned.- Parameters:
byteVal- byte value- Returns:
- A Uint16 instance
-
saturatedOf
Returns anUint16corresponding to a givenshortValif it is representable. If the value is negativeZEROwill be returned.- Parameters:
shortVal- short value- Returns:
- A Uint16 instance
-
saturatedOf
Returns anUint16corresponding to a givenintValif it is representable. If the value is negativeZEROwill be returned. If the value is greater than 65535,MAX_VALUEwill be returned.- Parameters:
intVal- int value- Returns:
- A Uint16 instance
-
saturatedOf
Returns anUint16corresponding to a givenlongValif it is representable. If the value is negativeZEROwill be returned. If the value is greater than 65535,MAX_VALUEwill be returned.- Parameters:
longVal- long value- Returns:
- A Uint16 instance
-
shortValue
public final short shortValue()The inverse operation is
fromShortBits(short). In case this value is greater thanShort.MAX_VALUE, the returned value will be equal tothis - 2^16.- Overrides:
shortValuein classNumber
-
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<Uint16>
-
toCanonicalString
Description copied from interface:CanonicalValueReturn the canonical string representation of this value.- Specified by:
toCanonicalStringin interfaceCanonicalValue<Uint16>- 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<Uint16>- Returns:
- A
CanonicalValueinstance.
-
intern
Return an interned (shared) instance equivalent to this object. This may return the same object.- Returns:
- A shared instance.
-
toJava
public final int toJava()Convert this value to anint.- Returns:
- An int
-
toUint8
Convert this value to aUint8.- Returns:
- A Uint8
- Throws:
IllegalArgumentException- if this value is greater than 255.
-
toUint32
Convert this value to aUint32.- Returns:
- A Uint32
-
toUint64
Convert this value to aUint64.- Returns:
- A Uint64
-
toSaturatedUint8
-
hashCode
public final int hashCode() -
equals
-
equals
A slightly faster version ofequals(Object).- Parameters:
obj- Uint16 object- Returns:
trueif this object is the same as the obj argument;falseotherwise.
-
toString
-