Package com.sun.jna
Class IntegerType
- java.lang.Object
- 
- java.lang.Number
- 
- com.sun.jna.IntegerType
 
 
- 
- All Implemented Interfaces:
- NativeMapped,- java.io.Serializable
 - Direct Known Subclasses:
- BaseTSD.DWORD_PTR,- BaseTSD.LONG_PTR,- BaseTSD.ULONG_PTR,- LibCAPI.size_t,- LibCAPI.ssize_t,- NativeLong,- OaIdl.VARIANT_BOOL,- Structure.FFIType.size_t,- WinDef.BOOL,- WinDef.CHAR,- WinDef.DWORD,- WinDef.DWORDLONG,- WinDef.INT_PTR,- WinDef.LONG,- WinDef.LONGLONG,- WinDef.SHORT,- WinDef.UCHAR,- WinDef.UINT,- WinDef.UINT_PTR,- WinDef.ULONG,- WinDef.ULONGLONG,- WinDef.USHORT,- WinDef.WORD,- XAttr.size_t,- XAttr.ssize_t
 
 public abstract class IntegerType extends java.lang.Number implements NativeMapped Represents a native integer value, which may have a platform-specific size (e.g.longon unix-based platforms). May optionally indicate an unsigned attribute, such that when a value is extracted into a larger-sized container (e.g.intretrieved viaNumber.longValue(), the value will be unsigned. Default behavior is signed.- Author:
- wmeissner@gmail.com, twalljava@java.net
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor 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.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcompare(long v1, long v2)static intcompare(IntegerType v1, long v2)Compares a IntegerType value with alongone.static <T extends IntegerType>
 intcompare(T v1, T v2)Compares 2 derivedIntegerTypevalues - Note: anullvalue is considered greater than any non-nullone (i.e.,nullvalues are "pushed" to the end of a sorted array / list of values)doubledoubleValue()booleanequals(java.lang.Object rhs)floatfloatValue()java.lang.ObjectfromNative(java.lang.Object nativeValue, FromNativeContext context)Convert the given native object into its Java representation using the given context.inthashCode()intintValue()longlongValue()java.lang.Class<?>nativeType()Indicate the native type used by this converter.voidsetValue(long value)Change the value for this data.java.lang.ObjecttoNative()Convert this object into a supported native type.java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
IntegerTypepublic IntegerType(int size) Create a zero-valued signed IntegerType.
 - 
IntegerTypepublic IntegerType(int size, boolean unsigned)Create a zero-valued optionally unsigned IntegerType.
 - 
IntegerTypepublic IntegerType(int size, long value)Create a signed IntegerType with the given value.
 - 
IntegerTypepublic IntegerType(int size, long value, boolean unsigned)Create an optionally signed IntegerType with the given value.
 
- 
 - 
Method Detail- 
setValuepublic void setValue(long value) Change the value for this data.- Parameters:
- value- value to set
 
 - 
toNativepublic java.lang.Object toNative() Description copied from interface:NativeMappedConvert this object into a supported native type.- Specified by:
- toNativein interface- NativeMapped
- Returns:
- Java representation of the original Java object converted to a native type.
 
 - 
fromNativepublic java.lang.Object fromNative(java.lang.Object nativeValue, FromNativeContext context)Description copied from interface:NativeMappedConvert the given native object into its Java representation using the given context.- Specified by:
- fromNativein interface- NativeMapped
- Parameters:
- nativeValue- Java representation of the native type to be converted.
- context- Context in which the conversion is taking place.
- Returns:
- Converted object.
 
 - 
nativeTypepublic java.lang.Class<?> nativeType() Description copied from interface:NativeMappedIndicate the native type used by this converter.- Specified by:
- nativeTypein interface- NativeMapped
- Returns:
- Java class representation of the native type.
 
 - 
intValuepublic int intValue() - Specified by:
- intValuein class- java.lang.Number
 
 - 
longValuepublic long longValue() - Specified by:
- longValuein class- java.lang.Number
 
 - 
floatValuepublic float floatValue() - Specified by:
- floatValuein class- java.lang.Number
 
 - 
doubleValuepublic double doubleValue() - Specified by:
- doubleValuein class- java.lang.Number
 
 - 
equalspublic boolean equals(java.lang.Object rhs) - Overrides:
- equalsin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
comparepublic static <T extends IntegerType> int compare(T v1, T v2) Compares 2 derivedIntegerTypevalues - Note: anullvalue is considered greater than any non-nullone (i.e.,nullvalues are "pushed" to the end of a sorted array / list of values)- Type Parameters:
- T- the derived integer type
- Parameters:
- v1- The 1st value
- v2- The 2nd value
- Returns:
- 0 if values are equal - including if both are null, negative if 1st value less than 2nd one, positive otherwise. Note: the comparison uses thelongValue().
- See Also:
- compare(long, long)
 
 - 
comparepublic static int compare(IntegerType v1, long v2) Compares a IntegerType value with alongone. Note: if the IntegerType value isnullthen it is consider greater than anylongvalue.- Parameters:
- v1- The- IntegerTypevalue
- v2- The- longvalue
- Returns:
- 0 if values are equal, negative if 1st value less than 2nd one,
 positive otherwise. Note: the comparison uses the longValue().
- See Also:
- compare(long, long)
 
 - 
comparepublic static final int compare(long v1, long v2)
 
- 
 
-