E
- public class NumericEnumProducer<E extends java.lang.Enum<E>> extends java.lang.Object implements TypeProducer<E,java.lang.Integer>
Constructor and Description |
---|
NumericEnumProducer(java.lang.Class<E> clazz,
java.lang.String field) |
Modifier and Type | Method and Description |
---|---|
E |
find(java.lang.Integer n)
Find the required object.
|
java.lang.String |
getField()
Name of the Database field we index.
|
FieldType<java.lang.Integer> |
getFieldType(E def)
Create a
FieldType to create an appropriate field. |
java.lang.Integer |
getIndex(E value)
Get the underlying data representation corresponding to the value
|
Input<java.lang.Integer> |
getInput()
get the Input associated with this object.
|
java.lang.Class<E> |
getTarget()
Get the type of the returned object as far as it is known.
|
protected int |
getValue(E e)
Method to generate the integer value of an enum.
|
java.util.Iterator<E> |
getValues() |
<X extends java.util.Set<E>> |
getValues(X set) |
public NumericEnumProducer(java.lang.Class<E> clazz, java.lang.String field)
public E find(java.lang.Integer n)
TypeConverter
find
in interface TypeConverter<E extends java.lang.Enum<E>,java.lang.Integer>
n
- Value of the database fieldprotected int getValue(E e)
Enum.ordinal()
but can be overridden if
a the Enum type can generate a custom value.e
- public java.lang.String getField()
TypeProducer
getField
in interface TypeProducer<E extends java.lang.Enum<E>,java.lang.Integer>
public java.lang.Integer getIndex(E value)
TypeConverter
getIndex
in interface TypeConverter<E extends java.lang.Enum<E>,java.lang.Integer>
public java.util.Iterator<E> getValues()
public <X extends java.util.Set<E>> X getValues(X set)
public java.lang.Class<E> getTarget()
Targetted
public FieldType<java.lang.Integer> getFieldType(E def)
TypeProducer
FieldType
to create an appropriate field.
The type of the field can be more tightly specified than the types that
can be converted.getFieldType
in interface TypeProducer<E extends java.lang.Enum<E>,java.lang.Integer>