T
- the type of Enum
public class MarshalQueryableEnum<T extends Enum<T>> extends Object implements MarshalQueryable<T>
TYPE_BYTE
or TYPE_INT32
.
Default values of the enum are mapped to its ordinal; this can be overridden
by providing a manual value with registerEnumValues(java.lang.Class<T>, int[])
.
Constructor and Description |
---|
MarshalQueryableEnum() |
Modifier and Type | Method and Description |
---|---|
Marshaler<T> |
createMarshaler(TypeReference<T> managedType,
int nativeType)
Create a marshaler between the selected managed and native type.
|
boolean |
isTypeMappingSupported(TypeReference<T> managedType,
int nativeType)
Determine whether or not this query marshal is able to create a marshaler that will
support the managed type and native type mapping.
|
static <T extends Enum<T>> |
registerEnumValues(Class<T> enumType,
int[] values)
Register a non-sequential set of values to be used with the marshal/unmarshal functions.
|
public Marshaler<T> createMarshaler(TypeReference<T> managedType, int nativeType)
MarshalQueryable
This marshaler instance is only good for that specific type mapping; and will refuse to map other managed types, other native types, or an other combination that isn't this exact one.
createMarshaler
in interface MarshalQueryable<T extends Enum<T>>
managedType
- a managed type referencenativeType
- the native type, e.g.
TYPE_BYTE
public boolean isTypeMappingSupported(TypeReference<T> managedType, int nativeType)
MarshalQueryable
If this returns true
, then a marshaler can be instantiated by
MarshalQueryable.createMarshaler(android.hardware.camera2.utils.TypeReference<T>, int)
that will marshal data to/from the native type
from/to the managed type.
Most marshalers are likely to only support one type map.
isTypeMappingSupported
in interface MarshalQueryable<T extends Enum<T>>
public static <T extends Enum<T>> void registerEnumValues(Class<T> enumType, int[] values)
This enables get/set to correctly marshal the enum into a value that is C-compatible.
enumType
- The class for an enumvalues
- A list of values mapping to the ordinals of the enum