Overview | Package | Class | Tree | Deprecated | Index | Help
| JNA API 3.3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jna
Class PointerType

    java.lang.Object
      com.sun.jna.PointerType

All Implemented Interfaces:
  NativeMapped

Direct Known Subclasses:
  ByReference, WinNT.HANDLE, 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 the `NativeMapped.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
`protected` | `PointerType()` The default constructor wraps a NULL pointer.
`protected` | `PointerType(Pointer p)` This constructor is typically used by `fromNative(java.lang.Object, com.sun.jna.FromNativeContext)` if generating a new object instance.

Method Summary
`boolean` | `equals(Object o)` Instances of `PointerType` 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 native `Pointer`.
`int` | `hashCode()` The hash code for a `PointerType` is the same as that for its pointer.
`Class` | `nativeType()` All `PointerType` classes represent a native `Pointer`.
`void` | `setPointer(Pointer p)`
`Object` | `toNative()` Convert this object to its native type (a `Pointer`).
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PointerType

    protected PointerType()

  The default constructor wraps a NULL pointer.

### PointerType

    protected PointerType(Pointer p)

  This constructor is typically used by `fromNative(java.lang.Object, com.sun.jna.FromNativeContext)` if generating a new object instance.

Method Detail

### nativeType

    public Class nativeType()

  All `PointerType` classes represent a native `Pointer`.

  Specified by:
    `nativeType` in interface `NativeMapped`

### toNative

    public Object toNative()

  Convert this object to its native type (a `Pointer`).

  Specified by:
    `toNative` in interface `NativeMapped`

### getPointer

    public Pointer getPointer()

  Returns the associated native `Pointer`.

### 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 single `PointerType` instance for each unique `Pointer` value, or instantiating a different `PointerType` subclass.

  Specified by:
    `fromNative` in interface `NativeMapped`

### hashCode

    public int hashCode()

  The hash code for a `PointerType` is the same as that for its pointer.

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object o)

  Instances of `PointerType` with identical pointers compare equal by default.

  Overrides:
    `equals` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| JNA API 3.3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007-2010 Timothy Wall. All Rights Reserved.