Package com.sun.jna
Class PointerType
- java.lang.Object
-
- com.sun.jna.PointerType
-
- All Implemented Interfaces:
NativeMapped
- Direct Known Subclasses:
ByReference
,COMInvoker
,CoreFoundation.CFTypeRef
,Ddeml.HCONV
,Ddeml.HCONVLIST
,Ddeml.HSZ
,Guid.REFIID
,IOKit.IOObject
,Udev.UdevContext
,Udev.UdevDevice
,Udev.UdevEnumerate
,Udev.UdevListEntry
,WinDef.LPVOID
,WinDef.PVOID
,WinNT.HANDLE
,WTypes.BSTR
,WTypes.LPOLESTR
,WTypes.LPSTR
,WTypes.LPWSTR
,X11.Display
,X11.GC
,X11.Screen
,X11.Visual
,X11.XImage
public abstract class PointerType extends Object implements NativeMapped
Type representing a type-safe native pointer. Derived classes may override theNativeMapped.fromNative(java.lang.Object, com.sun.jna.FromNativeContext)
method, which should instantiate a new object (or look up an existing one) of the appropriate type.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PointerType()
The default constructor wraps a NULL pointer.protected
PointerType(Pointer p)
This constructor is typically used byfromNative(java.lang.Object, com.sun.jna.FromNativeContext)
if generating a new object instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Instances ofPointerType
with identical pointers compare equal by default.Object
fromNative(Object nativeValue, FromNativeContext context)
The default implementation simply creates a new instance of the class and assigns its pointer field.Pointer
getPointer()
Returns the associated nativePointer
.int
hashCode()
The hash code for aPointerType
is the same as that for its pointer.Class<?>
nativeType()
Indicate the native type used by this converter.void
setPointer(Pointer p)
Object
toNative()
Convert this object to its native type (aPointer
).String
toString()
-
-
-
Constructor Detail
-
PointerType
protected PointerType()
The default constructor wraps a NULL pointer.
-
PointerType
protected PointerType(Pointer p)
This constructor is typically used byfromNative(java.lang.Object, com.sun.jna.FromNativeContext)
if generating a new object instance.
-
-
Method Detail
-
nativeType
public Class<?> nativeType()
Description copied from interface:NativeMapped
Indicate the native type used by this converter.- Specified by:
nativeType
in interfaceNativeMapped
- Returns:
- Java class representation of the native type.
-
toNative
public Object toNative()
Convert this object to its native type (aPointer
).- Specified by:
toNative
in interfaceNativeMapped
- Returns:
- Java representation of the original Java object converted to a native type.
-
getPointer
public Pointer getPointer()
Returns the associated nativePointer
.- Returns:
- Native pointer representation for this object.
-
setPointer
public void setPointer(Pointer p)
-
fromNative
public Object fromNative(Object nativeValue, FromNativeContext context)
The default implementation simply creates a new instance of the class and assigns its pointer field. Override if you need different behavior, such as ensuring a singlePointerType
instance for each uniquePointer
value, or instantiating a differentPointerType
subclass.- Specified by:
fromNative
in interfaceNativeMapped
- Parameters:
nativeValue
- Java representation of the native type to be converted.context
- Context in which the conversion is taking place.- Returns:
- Converted object.
-
hashCode
public int hashCode()
The hash code for aPointerType
is the same as that for its pointer.
-
equals
public boolean equals(Object o)
Instances ofPointerType
with identical pointers compare equal by default.
-
-