Class CtConstructorImpl<T>
java.lang.Object
spoon.support.reflect.declaration.CtElementImpl
spoon.support.reflect.declaration.CtNamedElementImpl
spoon.support.reflect.declaration.CtExecutableImpl<T>
spoon.support.reflect.declaration.CtConstructorImpl<T>
- All Implemented Interfaces:
Serializable,Cloneable,FactoryAccessor,CtBodyHolder,SourcePositionHolder,CtConstructor<T>,CtElement,CtExecutable<T>,CtFormalTypeDeclarer,CtModifiable,CtNamedElement,CtShadowable,CtTypedElement<T>,CtTypeMember,CtQueryable,CtVisitable
- Direct Known Subclasses:
InvisibleArrayConstructorImpl
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class spoon.support.reflect.declaration.CtElementImpl
ERROR_MESSAGE_TO_STRING, factory, LOGGER, parentFields inherited from interface spoon.reflect.declaration.CtExecutable
EXECUTABLE_SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts a visitor<C extends CtFormalTypeDeclarer>
CaddFormalCtTypeParameter(CtTypeParameter formalTypeParameter)Add a type parameter to this generic element.<C extends CtFormalTypeDeclarer>
CaddFormalCtTypeParameterAt(int position, CtTypeParameter formalTypeParameter)Add a type parameter at a specific position.<C extends CtModifiable>
CaddModifier(ModifierKind modifier)add a modifierclone()Clone the element which calls this method in a new object.Gets the type that declares this class member.Returns the formal type parameters of this generic element.Returns the modifiers of this element, excluding annotations.Returns the simple (unqualified) name of this element.getType()Gets this element's type.Gets the visibility of this modifiable element.booleanhasModifier(ModifierKind modifier)Tells if this element contains the given modifier.booleanReturns true if it contains an abstract modifier (seeCtModifiable.hasModifier(ModifierKind))booleanChecks if the constructor is a compact constructor.booleanisFinal()Returns true if it contains a final modifier (seeCtModifiable.hasModifier(ModifierKind))booleanisNative()Returns true if it contains a native modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a private modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a protected modifier (seeCtModifiable.hasModifier(ModifierKind))booleanisPublic()Returns true if it contains a public modifier (seeCtModifiable.hasModifier(ModifierKind))booleanisShadow()When an element isn't present in the factory (created in another factory), this element is considered as "shadow".booleanisStatic()Returns true if it contains a static modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a strictfp modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a synchronized modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a transient modifier (seeCtModifiable.hasModifier(ModifierKind))booleanReturns true if it contains a volatile modifier (seeCtModifiable.hasModifier(ModifierKind))booleanremoveFormalCtTypeParameter(CtTypeParameter formalTypeParameter)Removes a type parameters from this generic element.<C extends CtModifiable>
CremoveModifier(ModifierKind modifier)remove a modifiervoidsetCompactConstructor(boolean compactConstructor)Marks the constructor as a compact constructor.<T extends CtModifiable>
TsetExtendedModifiers(Set<CtExtendedModifier> extendedModifiers)<C extends CtFormalTypeDeclarer>
CsetFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)Sets the type parameters of this generic element.<C extends CtModifiable>
CsetModifiers(Set<ModifierKind> modifiers)Sets the modifiers.<E extends CtShadowable>
EsetShadow(boolean isShadow)Marks an element as shadow.<C extends CtNamedElement>
CsetSimpleName(String simpleName)Sets the simple (unqualified) name of this element.<C extends CtTypedElement>
CsetType(CtTypeReference type)Sets this element's type.<C extends CtModifiable>
CsetVisibility(ModifierKind visibility)Sets the visibility of this modifiable element (replaces old visibility).Methods inherited from class spoon.support.reflect.declaration.CtExecutableImpl
addParameter, addParameterAt, addThrownType, getBody, getParameters, getReference, getSignature, getThrownTypes, getTopLevelType, removeParameter, removeThrownType, setBody, setParameters, setThrownTypesMethods inherited from class spoon.support.reflect.declaration.CtElementImpl
addAnnotation, addComment, asIterable, comment, 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, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, unmodifiableList, updateAllParentsBelowMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface spoon.reflect.code.CtBodyHolder
setBodyMethods 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.CtExecutable
addParameter, addParameterAt, addThrownType, getBody, getParameters, getReference, getSignature, getThrownTypes, removeParameter, removeThrownType, setParameters, setThrownTypesMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtTypeMember
getTopLevelTypeMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtConstructorImpl
public CtConstructorImpl()
-
-
Method Details
-
accept
Description copied from interface:CtVisitableAccepts a visitor- Specified by:
acceptin interfaceCtVisitable
-
setSimpleName
Description copied from interface:CtNamedElementSets the simple (unqualified) name of this element.- Specified by:
setSimpleNamein interfaceCtConstructor<T>- Specified by:
setSimpleNamein interfaceCtNamedElement- Overrides:
setSimpleNamein classCtNamedElementImpl
-
getSimpleName
Description copied from interface:CtNamedElementReturns the simple (unqualified) name of this element.- Specified by:
getSimpleNamein interfaceCtConstructor<T>- Specified by:
getSimpleNamein interfaceCtNamedElement- Overrides:
getSimpleNamein classCtNamedElementImpl
-
getDeclaringType
Description copied from interface:CtTypeMemberGets the type that declares this class member.- Specified by:
getDeclaringTypein interfaceCtTypeMember- Overrides:
getDeclaringTypein classCtExecutableImpl<T>- Returns:
- declaring class
-
getType
Description copied from interface:CtTypedElementGets this element's type.- Specified by:
getTypein interfaceCtTypedElement<T>
-
setType
Description copied from interface:CtTypedElementSets this element's type.- Specified by:
setTypein interfaceCtConstructor<T>- Specified by:
setTypein interfaceCtTypedElement<T>
-
getFormalCtTypeParameters
Description copied from interface:CtFormalTypeDeclarerReturns the formal type parameters of this generic element.- Specified by:
getFormalCtTypeParametersin interfaceCtFormalTypeDeclarer
-
setFormalCtTypeParameters
public <C extends CtFormalTypeDeclarer> C setFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)Description copied from interface:CtFormalTypeDeclarerSets the type parameters of this generic element.- Specified by:
setFormalCtTypeParametersin interfaceCtFormalTypeDeclarer
-
addFormalCtTypeParameterAt
public <C extends CtFormalTypeDeclarer> C addFormalCtTypeParameterAt(int position, CtTypeParameter formalTypeParameter)Description copied from interface:CtFormalTypeDeclarerAdd a type parameter at a specific position.- Specified by:
addFormalCtTypeParameterAtin interfaceCtFormalTypeDeclarer- Parameters:
position- Position to insert the type parameter atformalTypeParameter- The type parameter to insert- Returns:
- The receiver
-
addFormalCtTypeParameter
public <C extends CtFormalTypeDeclarer> C addFormalCtTypeParameter(CtTypeParameter formalTypeParameter)Description copied from interface:CtFormalTypeDeclarerAdd a type parameter to this generic element.- Specified by:
addFormalCtTypeParameterin interfaceCtFormalTypeDeclarer
-
removeFormalCtTypeParameter
Description copied from interface:CtFormalTypeDeclarerRemoves a type parameters from this generic element.- Specified by:
removeFormalCtTypeParameterin interfaceCtFormalTypeDeclarer
-
getModifiers
Description copied from interface:CtModifiableReturns the modifiers of this element, excluding annotations. Implicit modifiers, such as thepublicandstaticmodifiers of interface members, are included.- Specified by:
getModifiersin interfaceCtModifiable- Returns:
- the modifiers of this declaration in undefined order; an empty set if there are none
-
hasModifier
Description copied from interface:CtModifiableTells if this element contains the given modifier.- Specified by:
hasModifierin interfaceCtModifiable- Parameters:
modifier- to search- Returns:
trueif this element contain the modifier
-
setModifiers
Description copied from interface:CtModifiableSets the modifiers.- Specified by:
setModifiersin interfaceCtModifiable
-
addModifier
Description copied from interface:CtModifiableadd a modifier- Specified by:
addModifierin interfaceCtModifiable
-
removeModifier
Description copied from interface:CtModifiableremove a modifier- Specified by:
removeModifierin interfaceCtModifiable
-
setVisibility
Description copied from interface:CtModifiableSets the visibility of this modifiable element (replaces old visibility).- Specified by:
setVisibilityin interfaceCtModifiable
-
getVisibility
Description copied from interface:CtModifiableGets the visibility of this modifiable element.- Specified by:
getVisibilityin interfaceCtModifiable
-
getExtendedModifiers
- Specified by:
getExtendedModifiersin interfaceCtModifiable- Returns:
- the set of extended modifiers (those incl. implicit).
-
setExtendedModifiers
- Specified by:
setExtendedModifiersin interfaceCtModifiable
-
isShadow
public boolean isShadow()Description copied from interface:CtShadowableWhen an element isn't present in the factory (created in another factory), this element is considered as "shadow". e.g., a shadow element can be a CtType of java.lang.Class built when we callCtTypeReference.getTypeDeclaration()on a reference of java.lang.Class.- Specified by:
isShadowin interfaceCtShadowable- Returns:
- true if the element is a shadow element, otherwise false.
-
setShadow
Description copied from interface:CtShadowableMarks an element as shadow. To know what is a shadow element, see the javadoc ofCtShadowable.isShadow().- Specified by:
setShadowin interfaceCtShadowable
-
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 interfaceCtConstructor<T>- Specified by:
clonein interfaceCtElement- Specified by:
clonein interfaceCtExecutable<T>- Specified by:
clonein interfaceCtNamedElement- Overrides:
clonein classCtExecutableImpl<T>
-
isPublic
public boolean isPublic()Description copied from interface:CtModifiableReturns true if it contains a public modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isPublicin interfaceCtModifiable
-
isPrivate
public boolean isPrivate()Description copied from interface:CtModifiableReturns true if it contains a private modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isPrivatein interfaceCtModifiable
-
isProtected
public boolean isProtected()Description copied from interface:CtModifiableReturns true if it contains a protected modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isProtectedin interfaceCtModifiable
-
isFinal
public boolean isFinal()Description copied from interface:CtModifiableReturns true if it contains a final modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isFinalin interfaceCtModifiable
-
isStatic
public boolean isStatic()Description copied from interface:CtModifiableReturns true if it contains a static modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isStaticin interfaceCtModifiable
-
isAbstract
public boolean isAbstract()Description copied from interface:CtModifiableReturns true if it contains an abstract modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isAbstractin interfaceCtModifiable
-
isTransient
public boolean isTransient()Description copied from interface:CtModifiableReturns true if it contains a transient modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isTransientin interfaceCtModifiable
-
isVolatile
public boolean isVolatile()Description copied from interface:CtModifiableReturns true if it contains a volatile modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isVolatilein interfaceCtModifiable
-
isSynchronized
public boolean isSynchronized()Description copied from interface:CtModifiableReturns true if it contains a synchronized modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isSynchronizedin interfaceCtModifiable
-
isNative
public boolean isNative()Description copied from interface:CtModifiableReturns true if it contains a native modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isNativein interfaceCtModifiable
-
isStrictfp
public boolean isStrictfp()Description copied from interface:CtModifiableReturns true if it contains a strictfp modifier (seeCtModifiable.hasModifier(ModifierKind))- Specified by:
isStrictfpin interfaceCtModifiable
-
setCompactConstructor
public void setCompactConstructor(boolean compactConstructor)Description copied from interface:CtConstructorMarks the constructor as a compact constructor. Only records have compact constructors.- Specified by:
setCompactConstructorin interfaceCtConstructor<T>- Parameters:
compactConstructor- true if the constructor is a compact constructor, false otherwise
-
isCompactConstructor
public boolean isCompactConstructor()Description copied from interface:CtConstructorChecks if the constructor is a compact constructor. Only records have compact constructors.- Specified by:
isCompactConstructorin interfaceCtConstructor<T>- Returns:
- true if the constructor is a compact constructor.
-