Package spoon.reflect.declaration
Interface CtConstructor<T>
- All Superinterfaces:
Cloneable,CtBodyHolder,CtElement,CtExecutable<T>,CtFormalTypeDeclarer,CtModifiable,CtNamedElement,CtQueryable,CtShadowable,CtTypedElement<T>,CtTypeMember,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Implementing Classes:
CtConstructorImpl,InvisibleArrayConstructorImpl
This element defines a constructor declaration.
-
Field Summary
Fields inherited from interface spoon.reflect.declaration.CtExecutable
EXECUTABLE_SEPARATOR -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the element which calls this method in a new object.Always returns "<init>".booleanChecks if the constructor is a compact constructor.voidsetCompactConstructor(boolean compactConstructor)Marks the constructor as a compact constructor.<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.Methods 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.declaration.CtFormalTypeDeclarer
addFormalCtTypeParameter, addFormalCtTypeParameterAt, getFormalCtTypeParameters, removeFormalCtTypeParameter, setFormalCtTypeParametersMethods 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, setVisibilityMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadowMethods inherited from interface spoon.reflect.declaration.CtTypedElement
getTypeMethods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelTypeMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getSimpleName
String getSimpleName()Always returns "<init>".- Specified by:
getSimpleNamein interfaceCtNamedElement
-
clone
CtConstructor<T> 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 interfaceCtElement- Specified by:
clonein interfaceCtExecutable<T>- Specified by:
clonein interfaceCtNamedElement
-
setType
Description copied from interface:CtTypedElementSets this element's type.- Specified by:
setTypein interfaceCtTypedElement<T>
-
setSimpleName
Description copied from interface:CtNamedElementSets the simple (unqualified) name of this element.- Specified by:
setSimpleNamein interfaceCtNamedElement
-
isCompactConstructor
boolean isCompactConstructor()Checks if the constructor is a compact constructor. Only records have compact constructors.- Returns:
- true if the constructor is a compact constructor.
-
setCompactConstructor
void setCompactConstructor(boolean compactConstructor)Marks the constructor as a compact constructor. Only records have compact constructors.- Parameters:
compactConstructor- true if the constructor is a compact constructor, false otherwise
-