public abstract class IntegerType extends Number implements NativeMapped
long on unix-based platforms).
May optionally indicate an unsigned attribute, such that when a value is
extracted into a larger-sized container (e.g. int retrieved
via Number.longValue(), the value will be unsigned. Default behavior
is signed.| Constructor and Description |
|---|
IntegerType(int size)
Create a zero-valued signed IntegerType.
|
IntegerType(int size,
boolean unsigned)
Create a zero-valued optionally unsigned IntegerType.
|
IntegerType(int size,
long value)
Create a signed IntegerType with the given value.
|
IntegerType(int size,
long value,
boolean unsigned)
Create an optionally signed IntegerType with the given value.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(IntegerType v1,
long v2)
Compares a IntegerType value with a
long one. |
static int |
compare(long v1,
long v2) |
static <T extends IntegerType> |
compare(T v1,
T v2)
Compares 2 derived
IntegerType values - Note: a
null value is considered greater than any non-null
one (i.e., null values are "pushed" to the end
of a sorted array / list of values) |
double |
doubleValue() |
boolean |
equals(Object rhs) |
float |
floatValue() |
Object |
fromNative(Object nativeValue,
FromNativeContext context)
Convert the given native object into its Java representation using
the given context.
|
int |
hashCode() |
int |
intValue() |
long |
longValue() |
Class<?> |
nativeType()
Indicate the native type used by this converter.
|
void |
setValue(long value)
Change the value for this data.
|
Object |
toNative()
Convert this object into a supported native type.
|
String |
toString() |
byteValue, shortValuepublic IntegerType(int size)
public IntegerType(int size,
boolean unsigned)
public IntegerType(int size,
long value)
public IntegerType(int size,
long value,
boolean unsigned)
public void setValue(long value)
value - value to setpublic Object toNative()
NativeMappedtoNative in interface NativeMappedpublic Object fromNative(Object nativeValue, FromNativeContext context)
NativeMappedfromNative in interface NativeMappednativeValue - Java representation of the native type to be converted.context - Context in which the conversion is taking place.public Class<?> nativeType()
NativeMappednativeType in interface NativeMappedpublic float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic static <T extends IntegerType> int compare(T v1, T v2)
IntegerType values - Note: a
null value is considered greater than any non-null
one (i.e., null values are "pushed" to the end
of a sorted array / list of values)T - the derived integer typev1 - The 1st valuev2 - The 2nd valuenull,
negative if 1st value less than 2nd one, positive otherwise. Note:
the comparison uses the longValue().compare(long, long)public static int compare(IntegerType v1, long v2)
long one. Note: if
the IntegerType value is null then it is consider greater
than any long value.v1 - The IntegerType valuev2 - The long valuelongValue().compare(long, long)public static final int compare(long v1,
long v2)