public class EnumClassDeclaration extends ClassDeclaration
EnumClassBuilder
transform an
EnumDeclaration
to an EnumClassDeclaration by
Currently anonymous implementations for constants are not supported as they are anonymous inner classes which are not supported by KeY.
The additional methods are constructed as follows (E is the name of the enum, (e1, ..., en) its constants):
public static E[] values() { return new E[] { e1,..., en } }; public static E valueOf(java.lang.String string) { for(E e : values()) { if(e.name().equals(string)) return e; } throw new IllegalArgumentException(); } public java.lang.String name() { return ENUM_NAMES[ordinal()]; }
Additionally the fields that are enum constants are remembered.
ProgramElement.TreeStructure
SourceElement.Position
ProgramModelElement.LexicalOrder
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ENUM_NAMES
name of the static variable of the array holding the names of the constants.
|
private java.util.List<EnumConstantDeclaration> |
enumConstants
store the EnumConstantDeclarations here.
|
private static java.lang.String |
NAME_PROTO |
private static long |
serialVersionUID |
private static java.lang.String |
VALUE_OF_PROTO |
private static java.lang.String |
VALUES_PROTO |
extending, implementing, typeParameters
members, name, name2field, name2type, parent, service, UNDEFINED_SCOPE
declarationSpecifiers
comments
factory
STRUCTURAL_EQUALITY, STRUCTURAL_HASH_CODE
LEXICAL_ORDER
Constructor and Description |
---|
EnumClassDeclaration() |
EnumClassDeclaration(EnumDeclaration ed)
make a new wrapping class declaration upon a given enum declaration.
|
Modifier and Type | Method and Description |
---|---|
private void |
addImplicitMethods() |
private void |
addInternalFields() |
private static Identifier |
createIdentifier(java.lang.String string) |
java.util.List<EnumConstantDeclaration> |
getEnumConstantDeclarations()
get all declared enum constants for this enum.
|
private MemberDeclaration |
makeConstantField(EnumConstantDeclaration ecd,
EnumDeclaration ed) |
private MethodDeclaration |
parseMethodDeclaration(java.lang.String string) |
accept, deepClone, getChildAt, getChildCount, getChildPositionCode, getExtendedTypes, getImplementedTypes, getStatementContainer, getTypeParameters, isAnnotationType, isEnumType, isInterface, isOrdinaryClass, isOrdinaryInterface, isStrictFp, isTransient, isVolatile, makeParentRoleValid, replaceChild, setExtendedTypes, setImplementedTypes, setStatementContainer, setTypeParameters
addTypeToScope, addVariableToScope, getAllFields, getAllMethods, getAllSupertypes, getAllTypes, getASTParent, getConstructors, getContainer, getContainingClassType, getFields, getFieldsInScope, getFirstElement, getFullName, getIdentifier, getLastElement, getMemberParent, getMembers, getMethods, getName, getPackage, getParent, getProgramModelInfo, getSupertypes, getTypeDeclarationAt, getTypeDeclarationCount, getTypeInScope, getTypes, getTypesInScope, getVariableInScope, getVariablesInScope, isAbstract, isDefinedScope, isFinal, isPrivate, isProtected, isPublic, isStatic, removeTypeFromScope, removeVariableFromScope, setDefinedScope, setIdentifier, setMemberParent, setMembers, setParent, setProgramModelInfo, toString
getAnnotations, getDeclarationSpecifiers, getModifiers, getVisibilityModifier, isNative, isSynchronized, setDeclarationSpecifiers
getIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll
getComments, setComments, validate
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getASTParent, getComments, setComments
getEndPosition, getFactory, getFirstElement, getLastElement, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
validate
getDeclarationSpecifiers, setDeclarationSpecifiers
getAnnotations
getIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll
private static final long serialVersionUID
private static final java.lang.String ENUM_NAMES
private static final java.lang.String VALUE_OF_PROTO
private static final java.lang.String VALUES_PROTO
private static final java.lang.String NAME_PROTO
private java.util.List<EnumConstantDeclaration> enumConstants
public EnumClassDeclaration()
public EnumClassDeclaration(EnumDeclaration ed)
private void addImplicitMethods()
private MethodDeclaration parseMethodDeclaration(java.lang.String string)
private void addInternalFields()
private static Identifier createIdentifier(java.lang.String string)
public java.util.List<EnumConstantDeclaration> getEnumConstantDeclarations()
private MemberDeclaration makeConstantField(EnumConstantDeclaration ecd, EnumDeclaration ed)