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>
,CtRecord
,CtResource<T>
,CtType<T>
,CtTypeMember
,CtTypeParameter
,CtVariable<T>
- All Known Implementing Classes:
CtAnnotationMethodImpl
,CtAnnotationTypeImpl
,CtAnonymousExecutableImpl
,CtCatchVariableImpl
,CtClassImpl
,CtConstructorImpl
,CtEnumImpl
,CtEnumValueImpl
,CtFieldImpl
,CtInterfaceImpl
,CtLocalVariableImpl
,CtMethodImpl
,CtParameterImpl
,CtRecordImpl
,CtTypeImpl
,CtTypeParameterImpl
,InvisibleArrayConstructorImpl
This interface defines an element that accepts modifiers.
-
Method Summary
Modifier and TypeMethodDescription<T extends CtModifiable>
TaddModifier(ModifierKind modifier)
add a modifierReturns the modifiers of this element, excluding annotations.Gets the visibility of this modifiable element.boolean
hasModifier(ModifierKind modifier)
Tells if this element contains the given modifier.boolean
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
Returns true if it contains a private modifier (seehasModifier(ModifierKind)
)boolean
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
Returns true if it contains a strictfp modifier (seehasModifier(ModifierKind)
)boolean
Returns true if it contains a synchronized modifier (seehasModifier(ModifierKind)
)boolean
Returns true if it contains a transient modifier (seehasModifier(ModifierKind)
)boolean
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 Details
-
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
Tells if this element contains the given modifier.- Parameters:
modifier
- to search- Returns:
true
if this element contain the modifier
-
setModifiers
Sets the modifiers. -
addModifier
add a modifier- Parameters:
modifier
-
-
removeModifier
remove a modifier- Parameters:
modifier
-
-
setVisibility
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
-
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)
)
-