Package jnr.ffi

Class StructLayout.EnumField<E extends Enum<E>>

Type Parameters:
E - the type of Enum
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 Details

    • enumClass

      protected final Class<E extends Enum<E>> enumClass
    • enumMapper

      protected final EnumMapper enumMapper
  • Constructor Details

    • 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 Details

    • 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:
      toString in class StructLayout.NumberField
      Parameters:
      ptr - The pointer to the field.
      Returns:
      a string representation of this field.