Package spoon.reflect.declaration
Interface CtModifiable
-
- All Superinterfaces:
Cloneable
,CtElement
,CtQueryable
,CtVisitable
,FactoryAccessor
,Serializable
,SourcePositionHolder
- All Known Subinterfaces:
CtAnnotationMethod<T>
,CtAnnotationType<T>
,CtAnonymousExecutable
,CtCatchVariable<T>
,CtClass<T>
,CtConstructor<T>
,CtEnum<T>
,CtEnumValue<T>
,CtField<T>
,CtFormalTypeDeclarer
,CtInterface<T>
,CtLocalVariable<T>
,CtMethod<T>
,CtParameter<T>
,CtType<T>
,CtTypeMember
,CtTypeParameter
,CtVariable<T>
- All Known Implementing Classes:
CtAnnotationMethodImpl
,CtAnnotationTypeImpl
,CtAnonymousExecutableImpl
,CtCatchVariableImpl
,CtClassImpl
,CtConstructorImpl
,CtEnumImpl
,CtEnumValueImpl
,CtFieldImpl
,CtInterfaceImpl
,CtLocalVariableImpl
,CtMethodImpl
,CtParameterImpl
,CtTypeImpl
,CtTypeParameterImpl
,InvisibleArrayConstructorImpl
public interface CtModifiable extends CtElement
This interface defines an element that accepts modifiers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends CtModifiable>
TaddModifier(ModifierKind modifier)
add a modifierSet<CtExtendedModifier>
getExtendedModifiers()
Set<ModifierKind>
getModifiers()
Returns the modifiers of this element, excluding annotations.ModifierKind
getVisibility()
Gets the visibility of this modifiable element.boolean
hasModifier(ModifierKind modifier)
Tells if this element contains the given modifier.boolean
isAbstract()
Returns true if it contains an abstract modifier (seehasModifier(ModifierKind)
)boolean
isFinal()
Returns true if it contains a final modifier (seehasModifier(ModifierKind)
)boolean
isNative()
Returns true if it contains a native modifier (seehasModifier(ModifierKind)
)boolean
isPrivate()
Returns true if it contains a private modifier (seehasModifier(ModifierKind)
)boolean
isProtected()
Returns true if it contains a protected modifier (seehasModifier(ModifierKind)
)boolean
isPublic()
Returns true if it contains a public modifier (seehasModifier(ModifierKind)
)boolean
isStatic()
Returns true if it contains a static modifier (seehasModifier(ModifierKind)
)boolean
isStrictfp()
Returns true if it contains a strictfp modifier (seehasModifier(ModifierKind)
)boolean
isSynchronized()
Returns true if it contains a synchronized modifier (seehasModifier(ModifierKind)
)boolean
isTransient()
Returns true if it contains a transient modifier (seehasModifier(ModifierKind)
)boolean
isVolatile()
Returns true if it contains a volatile modifier (seehasModifier(ModifierKind)
)<T extends CtModifiable>
TremoveModifier(ModifierKind modifier)
remove a modifier<T extends CtModifiable>
TsetExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)
<T extends CtModifiable>
TsetModifiers(Set<ModifierKind> modifiers)
Sets the modifiers.<T extends CtModifiable>
TsetVisibility(ModifierKind visibility)
Sets the visibility of this modifiable element (replaces old visibility).-
Methods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, clone, 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.visitor.chain.CtQueryable
filterChildren, map, map
-
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
-
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
-
-
-
Method Detail
-
getModifiers
Set<ModifierKind> getModifiers()
Returns the modifiers of this element, excluding annotations. Implicit modifiers, such as thepublic
andstatic
modifiers of interface members, are included.- Returns:
- the modifiers of this declaration in undefined order; an empty set if there are none
-
hasModifier
boolean hasModifier(ModifierKind modifier)
Tells if this element contains the given modifier.- Parameters:
modifier
- to search- Returns:
true
if this element contain the modifier
-
setModifiers
<T extends CtModifiable> T setModifiers(Set<ModifierKind> modifiers)
Sets the modifiers.
-
addModifier
<T extends CtModifiable> T addModifier(ModifierKind modifier)
add a modifier- Parameters:
modifier
-
-
removeModifier
<T extends CtModifiable> T removeModifier(ModifierKind modifier)
remove a modifier- Parameters:
modifier
-
-
setVisibility
<T extends CtModifiable> T setVisibility(ModifierKind visibility)
Sets the visibility of this modifiable element (replaces old visibility).
-
getVisibility
ModifierKind getVisibility()
Gets the visibility of this modifiable element.
-
getExtendedModifiers
Set<CtExtendedModifier> getExtendedModifiers()
- Returns:
- the set of extended modifiers (those incl. implicit).
-
setExtendedModifiers
<T extends CtModifiable> T setExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)
-
isPublic
boolean isPublic()
Returns true if it contains a public modifier (seehasModifier(ModifierKind)
)
-
isFinal
boolean isFinal()
Returns true if it contains a final modifier (seehasModifier(ModifierKind)
)
-
isStatic
boolean isStatic()
Returns true if it contains a static modifier (seehasModifier(ModifierKind)
)
-
isProtected
boolean isProtected()
Returns true if it contains a protected modifier (seehasModifier(ModifierKind)
)
-
isPrivate
boolean isPrivate()
Returns true if it contains a private modifier (seehasModifier(ModifierKind)
)
-
isAbstract
boolean isAbstract()
Returns true if it contains an abstract modifier (seehasModifier(ModifierKind)
)
-
isTransient
boolean isTransient()
Returns true if it contains a transient modifier (seehasModifier(ModifierKind)
)
-
isVolatile
boolean isVolatile()
Returns true if it contains a volatile modifier (seehasModifier(ModifierKind)
)
-
isSynchronized
boolean isSynchronized()
Returns true if it contains a synchronized modifier (seehasModifier(ModifierKind)
)
-
isNative
boolean isNative()
Returns true if it contains a native modifier (seehasModifier(ModifierKind)
)
-
isStrictfp
boolean isStrictfp()
Returns true if it contains a strictfp modifier (seehasModifier(ModifierKind)
)
-
-