Class Uint16
- java.lang.Object
-
- java.lang.Number
-
- org.opendaylight.yangtools.yang.common.Uint16
-
- All Implemented Interfaces:
Serializable
,Comparable<Uint16>
,Immutable
,MutationBehaviour<Immutable>
,CanonicalValue<Uint16>
@Beta @NonNullByDefault public class Uint16 extends Number implements CanonicalValue<Uint16>
Dedicated type for YANG's 'type uint16' type.- Author:
- Robert Varga
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Uint16.Support
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Uint16 o)
double
doubleValue()
boolean
equals(@Nullable Object obj)
boolean
equals(@Nullable Uint16 obj)
A slightly faster version ofequals(Object)
.float
floatValue()
static Uint16
fromShortBits(short bits)
Returns anUint16
corresponding to a given bit representation.int
hashCode()
Uint16
intern()
Return an interned (shared) instance equivalent to this object.int
intValue()
long
longValue()
short
shortValue()
CanonicalValueSupport<Uint16>
support()
Return theCanonicalValue
associated with this type.String
toCanonicalString()
Return the canonical string representation of this value.int
toJava()
Convert this value to anint
.String
toString()
Uint32
toUint32()
Convert this value to aUint32
.Uint64
toUint64()
Convert this value to aUint64
.Uint8
toUint8()
Convert this value to aUint8
.static Uint16
valueOf(byte byteVal)
Returns anUint16
corresponding to a givenbyteVal
.static Uint16
valueOf(int intVal)
Returns anUint16
corresponding to a givenintVal
.static Uint16
valueOf(long longVal)
Returns anUint16
corresponding to a givenlongVal
.static Uint16
valueOf(short shortVal)
Returns anUint16
corresponding to a givenshortVal
.static Uint16
valueOf(String string)
Returns anUint16
holding the value of the specifiedString
, parsed as an unsignedint
value.static Uint16
valueOf(String string, int radix)
Returns anUint16
holding the value of the specifiedString
, parsed as an unsignedint
value.static Uint16
valueOf(Uint32 uint)
Returns anUint8
corresponding to a givenuint
.static Uint16
valueOf(Uint64 uint)
Returns anUint8
corresponding to a givenuint
.static Uint16
valueOf(Uint8 uint)
Returns anUint16
corresponding to a givenuint
.-
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
-
Uint16
protected Uint16(Uint16 other)
-
-
Method Detail
-
fromShortBits
public static Uint16 fromShortBits(short bits)
Returns anUint16
corresponding 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
public static Uint16 valueOf(byte byteVal)
- Parameters:
byteVal
- byte value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException
- if byteVal is less than zero
-
valueOf
public static Uint16 valueOf(short shortVal)
- Parameters:
shortVal
- short value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException
- if shortVal is less than zero.
-
valueOf
public static Uint16 valueOf(int intVal)
- Parameters:
intVal
- int value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException
- if intVal is less than zero or greater than 65535.
-
valueOf
public static Uint16 valueOf(long longVal)
- Parameters:
longVal
- long value- Returns:
- A Uint16 instance
- Throws:
IllegalArgumentException
- if intVal is less than zero or greater than 65535.
-
valueOf
public static Uint16 valueOf(Uint8 uint)
Returns anUint16
corresponding to a givenuint
.- Parameters:
uint
- Uint8 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException
- if uint is null
-
valueOf
public static Uint16 valueOf(Uint32 uint)
Returns anUint8
corresponding to a givenuint
.- Parameters:
uint
- Uint32 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException
- if uint is nullIllegalArgumentException
- if uint is greater than 65535.
-
valueOf
public static Uint16 valueOf(Uint64 uint)
Returns anUint8
corresponding to a givenuint
.- Parameters:
uint
- Uint64 value- Returns:
- A Uint16 instance
- Throws:
NullPointerException
- if uint is nullIllegalArgumentException
- if uint is greater than 65535.
-
valueOf
public static Uint16 valueOf(String string)
Returns anUint16
holding the value of the specifiedString
, parsed as an unsignedint
value.- 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 unsignedint
value.
-
valueOf
public static Uint16 valueOf(String string, int radix)
Returns anUint16
holding the value of the specifiedString
, parsed as an unsignedint
value.- 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 unsignedint
value, or if theradix
is outside of allowed range.
-
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:
shortValue
in classNumber
-
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(Uint16 o)
- Specified by:
compareTo
in interfaceComparable<Uint16>
-
toCanonicalString
public final String toCanonicalString()
Description copied from interface:CanonicalValue
Return the canonical string representation of this value.- Specified by:
toCanonicalString
in interfaceCanonicalValue<Uint16>
- Returns:
- Canonical string
-
support
public final CanonicalValueSupport<Uint16> 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<Uint16>
- Returns:
- A
CanonicalValue
instance.
-
intern
public final Uint16 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
public final Uint8 toUint8()
Convert this value to aUint8
.- Returns:
- A Uint8
- Throws:
IllegalArgumentException
- if this value is greater than 255.
-
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 Uint16 obj)
A slightly faster version ofequals(Object)
.- Parameters:
obj
- Uint16 object- Returns:
true
if this object is the same as the obj argument;false
otherwise.
-
-