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

java.lang.Object
  extended by jnr.ffi.StructLayout.Field
      extended by jnr.ffi.StructLayout.NumberField
          extended by jnr.ffi.StructLayout.EnumField<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 Summary
protected  Class<E> enumClass
           
protected  EnumMapper enumMapper
           
 
Fields inherited from class jnr.ffi.StructLayout.NumberField
type
 
Constructor Summary
StructLayout.EnumField(NativeType type, Class<E> enumClass)
          Constructs a new Enum field.
 
Method Summary
 E get(Pointer ptr)
          Gets a java Enum value representing the native integer value.
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enumClass

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

enumMapper

protected final EnumMapper enumMapper
Constructor Detail

StructLayout.EnumField

public StructLayout.EnumField(NativeType type,
                              Class<E> enumClass)
Constructs a new Enum field.

Parameters:
type - the native type of the enum.
enumClass - the Enum class.
Method Detail

get

public E get(Pointer ptr)
Gets a java Enum value representing the native integer value.

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
Returns:
a string representation of this field.


Copyright © 2012. All Rights Reserved.