com.sun.jna.platform

## Class EnumConverter<T extends java.lang.Enum<T>>

- java.lang.Object
- - com.sun.jna.platform.EnumConverter<T>

- Type Parameters:
    `T` - the enum type
  All Implemented Interfaces:
    FromNativeConverter, ToNativeConverter, TypeConverter

      public class EnumConverter<T extends java.lang.Enum<T>>
      extends java.lang.Object
      implements TypeConverter

  A `TypeConverter` that maps an integer enum value to an actual Java enum.
  Author:
    Martin Steiger

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumConverter(java.lang.Class<T> clazz)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `fromNative(java.lang.Object input, FromNativeContext context)` Convert the given native object into its Java representation using the given context.
    `java.lang.Class<java.lang.Integer>` | `nativeType()` Indicate the native type used by this converter.
    `java.lang.Integer` | `toNative(java.lang.Object input, ToNativeContext context)` Convert a Java type to an appropriate native type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EnumConverter

          public EnumConverter(java.lang.Class<T> clazz)

      Parameters:
        `clazz` - the enum class

  - ### Method Detail

    - #### fromNative

          public T fromNative(java.lang.Object input,
                              FromNativeContext context)

      Description copied from interface: `FromNativeConverter`
      Convert the given native object into its Java representation using the given context.
      Specified by:
        `fromNative` in interface `FromNativeConverter`

    - #### toNative

          public java.lang.Integer toNative(java.lang.Object input,
                                            ToNativeContext context)

      Description copied from interface: `ToNativeConverter`
      Convert a Java type to an appropriate native type. The new type must be one of the following classes:
      - `Pointer`
      - Boolean
      - Byte
      - Short
      - Character
      - Integer
      - `NativeLong`
      - Long
      - Float
      - Double
      - `Structure`
      - String
      - `WString`
      - `Buffer` (unsupported in direct mode)
      - primitive array (unsupported in direct mode)
      Specified by:
        `toNative` in interface `ToNativeConverter`

    - #### nativeType

          public java.lang.Class<java.lang.Integer> nativeType()

      Description copied from interface: `FromNativeConverter`
      Indicate the native type used by this converter.
      Specified by:
        `nativeType` in interface `FromNativeConverter`
      Specified by:
        `nativeType` in interface `ToNativeConverter`

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