- 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 Enum<E>> extends StructLayout.NumberField
Base for all the Enum fields.
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<E>enumClassprotected EnumMapperenumMapper-
Fields inherited from class jnr.ffi.StructLayout.NumberField
type
-
-
Constructor Summary
Constructors Constructor Description EnumField(NativeType type, Class<E> enumClass)Constructs a new Enum field.EnumField(NativeType type, Class<E> enumClass, StructLayout.Offset offset)Constructs a new Enum field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Eget(Pointer ptr)Gets a java Enum value representing the native integer value.StringtoString(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, 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, 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 String toString(Pointer ptr)
Returns a string representation of this field.- Overrides:
toStringin classStructLayout.NumberField- Parameters:
ptr- The pointer to the field.- Returns:
- a string representation of this field.
-
-