Package jnr.ffi
Class StructLayout.EnumField<E extends java.lang.Enum<E>>
- java.lang.Object
-
- jnr.ffi.StructLayout.Field
-
- jnr.ffi.StructLayout.NumberField
-
- jnr.ffi.StructLayout.EnumField<E>
-
- Type Parameters:
E
- the type ofEnum
- Direct Known Subclasses:
StructLayout.Enum16
,StructLayout.Enum32
,StructLayout.Enum64
,StructLayout.Enum8
,StructLayout.EnumLong
- Enclosing class:
- StructLayout
protected abstract class StructLayout.EnumField<E extends java.lang.Enum<E>> extends StructLayout.NumberField
Base for all the Enum fields.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<E>
enumClass
protected EnumMapper
enumMapper
-
Fields inherited from class jnr.ffi.StructLayout.NumberField
type
-
-
Constructor Summary
Constructors Constructor Description EnumField(NativeType type, java.lang.Class<E> enumClass)
Constructs a new Enum field.EnumField(NativeType type, java.lang.Class<E> enumClass, StructLayout.Offset offset)
Constructs a new Enum field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
get(Pointer ptr)
Gets a java Enum value representing the native integer value.java.lang.String
toString(Pointer ptr)
Returns a string representation of this field.-
Methods inherited from class jnr.ffi.StructLayout.NumberField
byteValue, doubleValue, floatValue, intValue, longValue, set, shortValue
-
Methods inherited from class jnr.ffi.StructLayout.Field
enclosing, offset
-
-
-
-
Field Detail
-
enumMapper
protected final EnumMapper enumMapper
-
-
Constructor Detail
-
EnumField
public EnumField(NativeType type, java.lang.Class<E> enumClass)
Constructs a new Enum field.- Parameters:
type
- the native type of the enum.enumClass
- the Enum class.
-
EnumField
public EnumField(NativeType type, java.lang.Class<E> enumClass, StructLayout.Offset offset)
Constructs a new Enum field.- Parameters:
type
- the native type of the enum.enumClass
- the Enum class.offset
- the offset.
-
-
Method Detail
-
get
public E get(Pointer ptr)
Gets a java Enum value representing the native integer value.- Parameters:
ptr
- The pointer to the field.- Returns:
- a java Enum value.
-
toString
public final java.lang.String toString(Pointer ptr)
Returns a string representation of this field.- Overrides:
toString
in classStructLayout.NumberField
- Parameters:
ptr
- The pointer to the field.- Returns:
- a string representation of this field.
-
-