|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jwalk.gen.EnumGenerator
public class EnumGenerator
EnumGenerator is a custom generator to synthesise enumerated values.
For each descendant type of Enum, it is capable of identifying all
the enumerated values of that type and producing each of them in
order of enumeration.
EnumGenerator is automatically included as a delegate generator.
Field Summary | |
---|---|
protected java.util.Map<java.lang.Class<?>,java.lang.Integer> |
indexMap
The map relating each seen Enum type to a current index. |
Constructor Summary | |
---|---|
EnumGenerator()
Creates an EnumGenerator. |
Method Summary | |
---|---|
boolean |
canCreate(java.lang.Class<?> type)
Reports whether this EnumGenerator can create a given type. |
java.lang.Object |
nextValue(java.lang.Class<?> type)
Returns the next enumerated value in sequence. |
void |
setOwner(MasterGenerator generator)
Sets the owning MasterGenerator for this CustomGenerator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<java.lang.Class<?>,java.lang.Integer> indexMap
Constructor Detail |
---|
public EnumGenerator()
Method Detail |
---|
public boolean canCreate(java.lang.Class<?> type)
canCreate
in interface Generator
type
- the requested type.
public java.lang.Object nextValue(java.lang.Class<?> type) throws GeneratorException
nextValue
in interface Generator
type
- the requested enumerated type.
GeneratorException
- if the requested type is not an enumerated
type, or it was the abstract Enum and no concrete type could be found.public void setOwner(MasterGenerator generator)
setOwner
in interface CustomGenerator
generator
- the MasterGenerator of this EnumGenerator.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |