Package spoon.reflect.declaration
Interface CtEnum<T extends Enum<?>>
- All Superinterfaces:
Cloneable,CtClass<T>,CtCodeElement,CtElement,CtFormalTypeDeclarer,CtModifiable,CtNamedElement,CtQueryable,CtSealable,CtShadowable,CtStatement,CtType<T>,CtTypeInformation,CtTypeMember,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Implementing Classes:
CtEnumImpl
This element represents an enumeration declaration.
Example:
enum Boolean { TRUE, FALSE }
-
Field Summary
Fields inherited from interface spoon.reflect.declaration.CtType
INNERTTYPE_SEPARATOR, NAME_UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionaddEnumValue(CtEnumValue<?> enumValue)Adds an enum value.addPermittedType(CtTypeReference<?> type)Adds a permitted type to this type.clone()Clone the element which calls this method in a new object.CtEnumValue<?>getEnumValue(String name)Gets an enum value by its name.List<CtEnumValue<?>>Gets all enum values of the enumeration.Set<CtTypeReference<?>>Returns the permitted types for this type.booleanremoveEnumValue(CtEnumValue<?> enumValue)Removes en enum value.removePermittedType(CtTypeReference<?> type)Adds a permitted type to this type.setEnumValues(List<CtEnumValue<?>> enumValues)Sets all enum values of the enum.<T extends CtFormalTypeDeclarer>
TsetFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)Sets the type parameters of this generic element.setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes)Sets the permitted types for this type.setSuperclass(CtTypeReference<?> superClass)Sets the superclass type.Methods inherited from interface spoon.reflect.declaration.CtClass
addAnonymousExecutable, addConstructor, getAnonymousExecutables, getConstructor, getConstructors, isAnonymous, newInstance, removeAnonymousExecutable, removeConstructor, setAnonymousExecutables, setConstructors, setLabelMethods inherited from interface spoon.reflect.code.CtCodeElement
partiallyEvaluateMethods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelowMethods inherited from interface spoon.reflect.declaration.CtFormalTypeDeclarer
addFormalCtTypeParameter, addFormalCtTypeParameterAt, getFormalCtTypeParameters, removeFormalCtTypeParameterMethods inherited from interface spoon.reflect.declaration.CtModifiable
addModifier, getExtendedModifiers, getModifiers, getVisibility, hasModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, removeModifier, setExtendedModifiers, setModifiers, setVisibilityMethods inherited from interface spoon.reflect.declaration.CtNamedElement
setSimpleNameMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadowMethods inherited from interface spoon.reflect.code.CtStatement
comment, getLabel, insertAfter, insertAfter, insertBefore, insertBeforeMethods inherited from interface spoon.reflect.declaration.CtType
addField, addField, addFieldAtTop, addMethod, addNestedType, addSuperInterface, addTypeMember, addTypeMemberAt, compileAndReplaceSnippets, copyType, getActualClass, getAllMethods, getField, getFields, getMethod, getMethod, getMethods, getMethodsAnnotatedWith, getMethodsByName, getNestedType, getNestedTypes, getPackage, getReference, getSimpleName, getTypeMembers, getUsedTypes, hasMethod, isTopLevel, removeField, removeMethod, removeNestedType, removeSuperInterface, removeTypeMember, setFields, setMethods, setNestedTypes, setSuperInterfaces, setTypeMembers, toStringWithImportsMethods inherited from interface spoon.reflect.declaration.CtTypeInformation
getAllExecutables, getAllFields, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getModifiers, getQualifiedName, getSuperclass, getSuperInterfaces, getTypeErasure, isAnnotationType, isArray, isClass, isEnum, isGenerics, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOfMethods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelTypeMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
addEnumValue
Adds an enum value.- Parameters:
enumValue- An enum value.- Returns:
- true if this element changed as a result of the call
-
removeEnumValue
Removes en enum value.- Parameters:
enumValue- An enum value.- Returns:
- true if this element changed as a result of the call
-
getEnumValue
Gets an enum value by its name.- Parameters:
name- Name of the enum value.- Returns:
- An enum value.
-
getEnumValues
List<CtEnumValue<?>> getEnumValues()Gets all enum values of the enumeration.- Returns:
- All enum values.
-
setEnumValues
Sets all enum values of the enum. -
clone
Description copied from interface:CtElementClone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methodsRefactoring.copyType(CtType)andRefactoring.copyMethod(CtMethod)instead which does additional work beyond cloning.- Specified by:
clonein interfaceCtClass<T extends Enum<?>>- Specified by:
clonein interfaceCtCodeElement- Specified by:
clonein interfaceCtElement- Specified by:
clonein interfaceCtNamedElement- Specified by:
clonein interfaceCtStatement- Specified by:
clonein interfaceCtType<T extends Enum<?>>
-
setFormalCtTypeParameters
<T extends CtFormalTypeDeclarer> T setFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)Description copied from interface:CtFormalTypeDeclarerSets the type parameters of this generic element.- Specified by:
setFormalCtTypeParametersin interfaceCtFormalTypeDeclarer
-
setSuperclass
Description copied from interface:CtTypeSets the superclass type.- Specified by:
setSuperclassin interfaceCtType<T extends Enum<?>>
-
getPermittedTypes
Set<CtTypeReference<?>> getPermittedTypes()Description copied from interface:CtSealableReturns the permitted types for this type.- Specified by:
getPermittedTypesin interfaceCtSealable- Returns:
- an unmodifiable view of the permitted types.
-
setPermittedTypes
Description copied from interface:CtSealableSets the permitted types for this type. Calling this method does not change the state of theModifierKind.SEALEDfor this type. The previously permitted types will be removed.- Specified by:
setPermittedTypesin interfaceCtSealable- Parameters:
permittedTypes- the permitted types to set.- Returns:
- this.
-
addPermittedType
Description copied from interface:CtSealableAdds a permitted type to this type. Calling this method does not change the state of theModifierKind.SEALEDfor this type.- Specified by:
addPermittedTypein interfaceCtSealable- Parameters:
type- the type to add as permitted type.- Returns:
- this.
-
removePermittedType
Description copied from interface:CtSealableAdds a permitted type to this type. Calling this method does not change the state of theModifierKind.SEALEDfor this type.- Specified by:
removePermittedTypein interfaceCtSealable- Parameters:
type- the type to remove from this type's permitted types.- Returns:
- this.
-