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.TreeStructureSourceElement.PositionProgramModelElement.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, typeParametersmembers, name, name2field, name2type, parent, service, UNDEFINED_SCOPEdeclarationSpecifierscommentsfactorySTRUCTURAL_EQUALITY, STRUCTURAL_HASH_CODELEXICAL_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, setTypeParametersaddTypeToScope, 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, toStringgetAnnotations, getDeclarationSpecifiers, getModifiers, getVisibilityModifier, isNative, isSynchronized, setDeclarationSpecifiersgetIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAllgetComments, setComments, validategetEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSourceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetASTParent, getComments, setCommentsgetEndPosition, getFactory, getFirstElement, getLastElement, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSourcevalidategetDeclarationSpecifiers, setDeclarationSpecifiersgetAnnotationsgetIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAllprivate 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)