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
public interface CtEnum<T extends Enum<?>> extends CtClass<T>
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C extends CtEnum<T>>
CaddEnumValue(CtEnumValue<?> enumValue)
Adds an enum value.CtEnum<T>
addPermittedType(CtTypeReference<?> type)
Adds a permitted type to this type.CtEnum<T>
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<?>>
getEnumValues()
Gets all enum values of the enumeration.Set<CtTypeReference<?>>
getPermittedTypes()
Returns the permitted types for this type.boolean
removeEnumValue(CtEnumValue<?> enumValue)
Removes en enum value.CtEnum<T>
removePermittedType(CtTypeReference<?> type)
Adds a permitted type to this type.<C extends CtEnum<T>>
CsetEnumValues(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.CtEnum<T>
setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes)
Sets the permitted types for this type.<C extends CtType<T>>
CsetSuperclass(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, setLabel
-
Methods inherited from interface spoon.reflect.code.CtCodeElement
partiallyEvaluate
-
Methods 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, updateAllParentsBelow
-
Methods inherited from interface spoon.reflect.declaration.CtFormalTypeDeclarer
addFormalCtTypeParameter, addFormalCtTypeParameterAt, getFormalCtTypeParameters, removeFormalCtTypeParameter
-
Methods 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, setVisibility
-
Methods inherited from interface spoon.reflect.declaration.CtNamedElement
setSimpleName
-
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
-
Methods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadow
-
Methods inherited from interface spoon.reflect.code.CtStatement
comment, getLabel, insertAfter, insertAfter, insertBefore, insertBefore
-
Methods 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, toStringWithImports
-
Methods 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, isSubtypeOf
-
Methods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelType
-
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
-
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
-
-
-
Method Detail
-
addEnumValue
<C extends CtEnum<T>> C addEnumValue(CtEnumValue<?> enumValue)
Adds an enum value.- Parameters:
enumValue
- An enum value.- Returns:
- true if this element changed as a result of the call
-
removeEnumValue
boolean removeEnumValue(CtEnumValue<?> enumValue)
Removes en enum value.- Parameters:
enumValue
- An enum value.- Returns:
- true if this element changed as a result of the call
-
getEnumValue
CtEnumValue<?> getEnumValue(String name)
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
<C extends CtEnum<T>> C setEnumValues(List<CtEnumValue<?>> enumValues)
Sets all enum values of the enum.
-
clone
CtEnum<T> clone()
Description copied from interface:CtElement
Clone 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:
clone
in interfaceCtClass<T extends Enum<?>>
- Specified by:
clone
in interfaceCtCodeElement
- Specified by:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtNamedElement
- Specified by:
clone
in interfaceCtStatement
- Specified by:
clone
in interfaceCtType<T extends Enum<?>>
-
setFormalCtTypeParameters
<T extends CtFormalTypeDeclarer> T setFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)
Description copied from interface:CtFormalTypeDeclarer
Sets the type parameters of this generic element.- Specified by:
setFormalCtTypeParameters
in interfaceCtFormalTypeDeclarer
-
setSuperclass
<C extends CtType<T>> C setSuperclass(CtTypeReference<?> superClass)
Description copied from interface:CtType
Sets the superclass type.- Specified by:
setSuperclass
in interfaceCtType<T extends Enum<?>>
-
getPermittedTypes
Set<CtTypeReference<?>> getPermittedTypes()
Description copied from interface:CtSealable
Returns the permitted types for this type.- Specified by:
getPermittedTypes
in interfaceCtSealable
- Returns:
- an unmodifiable view of the permitted types.
-
setPermittedTypes
CtEnum<T> setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes)
Description copied from interface:CtSealable
Sets the permitted types for this type. Calling this method does not change the state of theModifierKind.SEALED
for this type. The previously permitted types will be removed.- Specified by:
setPermittedTypes
in interfaceCtSealable
- Parameters:
permittedTypes
- the permitted types to set.- Returns:
- this.
-
addPermittedType
CtEnum<T> addPermittedType(CtTypeReference<?> type)
Description copied from interface:CtSealable
Adds a permitted type to this type. Calling this method does not change the state of theModifierKind.SEALED
for this type.- Specified by:
addPermittedType
in interfaceCtSealable
- Parameters:
type
- the type to add as permitted type.- Returns:
- this.
-
removePermittedType
CtEnum<T> removePermittedType(CtTypeReference<?> type)
Description copied from interface:CtSealable
Adds a permitted type to this type. Calling this method does not change the state of theModifierKind.SEALED
for this type.- Specified by:
removePermittedType
in interfaceCtSealable
- Parameters:
type
- the type to remove from this type's permitted types.- Returns:
- this.
-
-