public class CtFieldImpl<T> extends CtNamedElementImpl implements CtField<T>
CtField
.ERROR_MESSAGE_TO_STRING, LOGGER, parent
FIELD_SEPARATOR
Constructor and Description |
---|
CtFieldImpl() |
Modifier and Type | Method and Description |
---|---|
void |
accept(CtVisitor v)
Accepts a visitor
|
<C extends CtModifiable> |
addModifier(ModifierKind modifier)
add a modifier
|
CtField<T> |
clone()
Clone the element which calls this method in a new object.
|
CtExpression<T> |
getAssignment()
Useful proxy to
CtVariable.getDefaultExpression() . |
CtType<?> |
getDeclaringType()
Gets the type that declares this class member.
|
CtExpression<T> |
getDefaultExpression()
Gets the initialization expression assigned to the variable (also known
as the initializer), when declared.
|
Set<CtExtendedModifier> |
getExtendedModifiers() |
Set<ModifierKind> |
getModifiers()
Returns the modifiers of this element, excluding annotations.
|
CtFieldReference<T> |
getReference()
Returns the corresponding reference.
|
<T> CtType<T> |
getTopLevelType()
Returns the top level type declaring this type if an inner type or type member.
|
CtTypeReference<T> |
getType()
Gets this element's type.
|
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 (see
CtModifiable.hasModifier(ModifierKind) ) |
boolean |
isFinal()
Returns true if it contains a final modifier (see
CtModifiable.hasModifier(ModifierKind) ) |
boolean |
isPrivate()
Returns true if it contains a private modifier (see
CtModifiable.hasModifier(ModifierKind) ) |
boolean |
isProtected()
Returns true if it contains a protected modifier (see
CtModifiable.hasModifier(ModifierKind) ) |
boolean |
isPublic()
Returns true if it contains a public modifier (see
CtModifiable.hasModifier(ModifierKind) ) |
boolean |
isShadow()
When an element isn't present in the factory (created in another factory),
this element is considered as "shadow".
|
boolean |
isStatic()
Returns true if it contains a static modifier (see
CtModifiable.hasModifier(ModifierKind) ) |
<C extends CtModifiable> |
removeModifier(ModifierKind modifier)
remove a modifier
|
<C extends CtRHSReceiver<T>> |
setAssignment(CtExpression<T> assignment)
Sets the right-hand side expression (RHS) of the "=" operator.
|
<C extends CtVariable<T>> |
setDefaultExpression(CtExpression<T> defaultExpression)
Sets the initialization expression assigned to the variable, when
declared.
|
<C extends CtModifiable> |
setExtendedModifiers(Set<CtExtendedModifier> extendedModifiers) |
<C extends CtModifiable> |
setModifiers(Set<ModifierKind> modifiers)
Sets the modifiers.
|
<E extends CtShadowable> |
setShadow(boolean isShadow)
Marks an element as shadow.
|
<C extends CtTypedElement> |
setType(CtTypeReference<T> type)
Sets this element's type.
|
<C extends CtModifiable> |
setVisibility(ModifierKind visibility)
Sets the visibility of this modifiable element (replaces old visibility).
|
getSimpleName, setSimpleName
addAnnotation, addComment, asIterable, delete, descendantIterator, emptyList, emptySet, equals, filterChildren, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getFactory, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hashCode, hasParent, isImplicit, isParentInitialized, map, map, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, unmodifiableList, updateAllParentsBelow
finalize, getClass, notify, notifyAll, wait, wait, wait
getSimpleName, setSimpleName
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, updateAllParentsBelow
getFactory, setFactory
filterChildren, map, map
getOriginalSourceFragment
public void accept(CtVisitor v)
CtVisitable
accept
in interface CtVisitable
public CtType<?> getDeclaringType()
CtTypeMember
getDeclaringType
in interface CtTypeMember
public <T> CtType<T> getTopLevelType()
CtTypeMember
getTopLevelType
in interface CtTypeMember
public CtExpression<T> getDefaultExpression()
CtVariable
getDefaultExpression
in interface CtVariable<T>
public CtFieldReference<T> getReference()
CtNamedElement
getReference
in interface CtField<T>
getReference
in interface CtNamedElement
getReference
in interface CtVariable<T>
getReference
in class CtNamedElementImpl
public CtTypeReference<T> getType()
CtTypedElement
getType
in interface CtTypedElement<T>
public <C extends CtVariable<T>> C setDefaultExpression(CtExpression<T> defaultExpression)
CtVariable
setDefaultExpression
in interface CtVariable<T>
public <C extends CtTypedElement> C setType(CtTypeReference<T> type)
CtTypedElement
setType
in interface CtTypedElement<T>
public Set<ModifierKind> getModifiers()
CtModifiable
public
and static
modifiers of
interface members, are included.getModifiers
in interface CtModifiable
public boolean hasModifier(ModifierKind modifier)
CtModifiable
hasModifier
in interface CtModifiable
modifier
- to searchtrue
if this element contain the modifierpublic <C extends CtModifiable> C setModifiers(Set<ModifierKind> modifiers)
CtModifiable
setModifiers
in interface CtModifiable
public <C extends CtModifiable> C addModifier(ModifierKind modifier)
CtModifiable
addModifier
in interface CtModifiable
public <C extends CtModifiable> C removeModifier(ModifierKind modifier)
CtModifiable
removeModifier
in interface CtModifiable
public Set<CtExtendedModifier> getExtendedModifiers()
getExtendedModifiers
in interface CtModifiable
public <C extends CtModifiable> C setExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)
setExtendedModifiers
in interface CtModifiable
public <C extends CtModifiable> C setVisibility(ModifierKind visibility)
CtModifiable
setVisibility
in interface CtModifiable
public ModifierKind getVisibility()
CtModifiable
getVisibility
in interface CtModifiable
public CtExpression<T> getAssignment()
CtField
CtVariable.getDefaultExpression()
.getAssignment
in interface CtRHSReceiver<T>
getAssignment
in interface CtField<T>
public <C extends CtRHSReceiver<T>> C setAssignment(CtExpression<T> assignment)
CtRHSReceiver
setAssignment
in interface CtRHSReceiver<T>
setAssignment
in interface CtField<T>
public boolean isShadow()
CtShadowable
CtTypeReference.getTypeDeclaration()
on a reference of java.lang.Class.isShadow
in interface CtShadowable
public <E extends CtShadowable> E setShadow(boolean isShadow)
CtShadowable
CtShadowable.isShadow()
.setShadow
in interface CtShadowable
public CtField<T> clone()
CtElement
Refactoring.copyType(CtType)
and Refactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.clone
in interface CtElement
clone
in interface CtField<T>
clone
in interface CtNamedElement
clone
in class CtNamedElementImpl
public boolean isPublic()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isPublic
in interface CtModifiable
public boolean isPrivate()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isPrivate
in interface CtModifiable
public boolean isProtected()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isProtected
in interface CtModifiable
public boolean isFinal()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isFinal
in interface CtModifiable
public boolean isStatic()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isStatic
in interface CtModifiable
public boolean isAbstract()
CtModifiable
CtModifiable.hasModifier(ModifierKind)
)isAbstract
in interface CtModifiable
Copyright © 2007–2019 Inria. All rights reserved.