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
public interface CtConstructor<T> extends CtExecutable<T>, CtFormalTypeDeclarer, CtShadowable
This element defines a constructor declaration.
-
-
Field Summary
-
Fields inherited from interface spoon.reflect.declaration.CtExecutable
EXECUTABLE_SEPARATOR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CtConstructor<T>
clone()
Clone the element which calls this method in a new object.String
getSimpleName()
Always returns "<init>".boolean
isCompactConstructor()
Checks if the constructor is a compact constructor.void
setCompactConstructor(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<T> type)
Sets this element's type.-
Methods inherited from interface spoon.reflect.code.CtBodyHolder
setBody
-
Methods 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, updateAllParentsBelow
-
Methods inherited from interface spoon.reflect.declaration.CtExecutable
addParameter, addParameterAt, addThrownType, getBody, getParameters, getReference, getSignature, getThrownTypes, removeParameter, removeThrownType, setParameters, setThrownTypes
-
Methods inherited from interface spoon.reflect.declaration.CtFormalTypeDeclarer
addFormalCtTypeParameter, addFormalCtTypeParameterAt, getFormalCtTypeParameters, removeFormalCtTypeParameter, setFormalCtTypeParameters
-
Methods 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, setVisibility
-
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
-
Methods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadow
-
Methods inherited from interface spoon.reflect.declaration.CtTypedElement
getType
-
Methods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelType
-
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
-
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
-
-
-
Method Detail
-
getSimpleName
String getSimpleName()
Always returns "<init>".- Specified by:
getSimpleName
in interfaceCtNamedElement
-
clone
CtConstructor<T> clone()
Description copied from interface:CtElement
Clone 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:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtExecutable<T>
- Specified by:
clone
in interfaceCtNamedElement
-
setType
<C extends CtTypedElement> C setType(CtTypeReference<T> type)
Description copied from interface:CtTypedElement
Sets this element's type.- Specified by:
setType
in interfaceCtTypedElement<T>
-
setSimpleName
<C extends CtNamedElement> C setSimpleName(String simpleName)
Description copied from interface:CtNamedElement
Sets the simple (unqualified) name of this element.- Specified by:
setSimpleName
in 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
-
-