Package com.sun.jna.platform
Class EnumConverter<T extends 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 Enum<T>> extends Object implements TypeConverter
ATypeConverter
that maps an integer enum value to an actual Java enum.- Author:
- Martin Steiger
-
-
Constructor Summary
Constructors Constructor Description EnumConverter(Class<T> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
fromNative(Object input, FromNativeContext context)
Convert the given native object into its Java representation using the given context.Class<Integer>
nativeType()
Indicate the native type used by this converter.Integer
toNative(Object input, ToNativeContext context)
Convert a Java type to an appropriate native type.
-
-
-
Method Detail
-
fromNative
public T fromNative(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 interfaceFromNativeConverter
-
toNative
public Integer toNative(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 interfaceToNativeConverter
-
nativeType
public Class<Integer> nativeType()
Description copied from interface:FromNativeConverter
Indicate the native type used by this converter.- Specified by:
nativeType
in interfaceFromNativeConverter
- Specified by:
nativeType
in interfaceToNativeConverter
-
-