public class UnsignedShort extends DataValue
DataValue subclass that wraps a UnsignedShort.value
of type unsignedShort
.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_VALUE
Maximum unsigned short value.
|
static UnsignedShort |
zero |
Modifier and Type | Method and Description |
---|---|
static int |
compare(UnsignedShort left,
UnsignedShort right)
Compare two wrapped values for ordering.
|
static boolean |
equal(UnsignedShort left,
UnsignedShort right)
Compare two wrapped values for equality.
|
boolean |
equals(java.lang.Object value)
Return
true if this object is equal to value . |
DataType |
getDataType()
Return the type BasicType.UNSIGNED_SHORT.
|
int |
getTypeCode()
Return data type code of the wrapped value, equivalent to
dataType.code . |
int |
getValue()
Return the wrapped value.
|
int |
hashCode()
Hash the wrapped value to a number.
|
static UnsignedShort |
of(int value)
Wrap an
unsignedShort value as an object. |
static UnsignedShort |
ofNullable(java.lang.Integer value)
Wrap a nullable
unsignedShort value as an object. |
static int |
toInt(short value)
Convert a signed
short value to unsigned int . |
static java.lang.Integer |
toNullable(java.lang.Object value)
Convert a wrapped
unsignedShort value to an unsigned short. |
java.lang.String |
toString()
Convert this data value to a string.
|
static int |
unwrap(java.lang.Object value)
Convert a wrapped
unsignedShort value to an unsigned short. |
static int |
validate(int value)
Check if argument would be a valid
UnsignedShort . |
cloneMutable
public static final int MAX_VALUE
Maximum unsigned short value.
public static final UnsignedShort zero
public static int compare(UnsignedShort left, UnsignedShort right)
Compare two wrapped values for ordering.
left
- First object for comparison.right
- Second object for comparison.left.value < right.value
, 0 if left.value == right.value
, or 1 if left.value > right.value
.public static boolean equal(UnsignedShort left, UnsignedShort right)
Compare two wrapped values for equality.
left
- (nullable) First object for comparison.right
- (nullable) Second object for comparison.true
if left.value == right.value
or if both arguments are null
, otherwise false
.public boolean equals(java.lang.Object value)
Return true
if this object is equal to value
.
public DataType getDataType()
Return the type BasicType.UNSIGNED_SHORT.
getDataType
in class DataValue
public int getTypeCode()
Return data type code of the wrapped value, equivalent to dataType.code
.
getTypeCode
in class DataValue
dataType.code
.public int getValue()
Return the wrapped value.
public int hashCode()
Hash the wrapped value to a number.
public static UnsignedShort of(int value)
Wrap an unsignedShort
value as an object.
value
- Value to be wrapped.public static UnsignedShort ofNullable(java.lang.Integer value)
Wrap a nullable unsignedShort
value as an object.
value
- (nullable) Value to be wrapped.public static int toInt(short value)
Convert a signed short
value to unsigned int
.
value
- The short value.public static java.lang.Integer toNullable(java.lang.Object value)
Convert a wrapped unsignedShort
value to an unsigned short.
CastException
if value
is not a wrapped unsignedShort
or null
.
value
- (nullable) The wrapped value.public java.lang.String toString()
Convert this data value to a string.
If the UnsignedShort.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).
public static int unwrap(java.lang.Object value)
Convert a wrapped unsignedShort
value to an unsigned short.
CastException
if value
is not a wrapped unsignedShort
.
value
- (nullable) The wrapped value.public static int validate(int value)
Check if argument would be a valid UnsignedShort
.
CastException
if value
is out of the valid range of UnsignedShort
.
value
- The value to be validated.