Class CtRecordComponentImpl
java.lang.Object
spoon.support.reflect.declaration.CtElementImpl
spoon.support.reflect.declaration.CtNamedElementImpl
spoon.support.reflect.declaration.CtRecordComponentImpl
- All Implemented Interfaces:
Serializable
,Cloneable
,FactoryAccessor
,SourcePositionHolder
,CtElement
,CtNamedElement
,CtRecordComponent
,CtShadowable
,CtTypedElement<Object>
,CtQueryable
,CtVisitable
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class spoon.support.reflect.declaration.CtElementImpl
ERROR_MESSAGE_TO_STRING, factory, LOGGER, parent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts a visitorclone()
Clone the element which calls this method in a new object.getType()
Gets this element's type.boolean
Returns true if this element is not present in the code (automatically added by the Java compiler or inferred when the model is built).boolean
isShadow()
When an element isn't present in the factory (created in another factory), this element is considered as "shadow".<E extends CtShadowable>
EsetShadow(boolean isShadow)
Marks an element as shadow.<T extends CtNamedElement>
TsetSimpleName(String simpleName)
Sets the simple (unqualified) name of this element.<C extends CtTypedElement>
CsetType(CtTypeReference type)
Sets this element's type.CtField<?>
toField()
Converts the component to an implicit field.The returned field is a view and has no parent.CtMethod<?>
toMethod()
Converts the component to an implicit method.Methods inherited from class spoon.support.reflect.declaration.CtNamedElementImpl
getReference, getSimpleName
Methods 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, isParentInitialized, map, map, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, unmodifiableList, updateAllParentsBelow
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
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, 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.CtNamedElement
getReference, getSimpleName
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtRecordComponentImpl
public CtRecordComponentImpl()
-
-
Method Details
-
toMethod
Description copied from interface:CtRecordComponent
Converts the component to an implicit method. The returned method is a view and has no parent. This means that any modification on the returned method will not be reflected on the component. Also this element is not part of the model. A record already has the methods corresponding to its components. UseCtType.getMethods()
to get the getter methods of a record.- Specified by:
toMethod
in interfaceCtRecordComponent
- Returns:
- the method corresponding to the component (a getter) as a view.
-
toField
Description copied from interface:CtRecordComponent
Converts the component to an implicit field.The returned field is a view and has no parent. This means that any modification on the returned field will not be reflected on the component. Also this element is not part of the model. A record already has the field corresponding to its components. UseCtType.getFields()
to get the fields of a record.- Specified by:
toField
in interfaceCtRecordComponent
- Returns:
- the field corresponding to the component as a view.
-
isImplicit
public boolean isImplicit()Description copied from interface:CtElement
Returns true if this element is not present in the code (automatically added by the Java compiler or inferred when the model is built). Consequently, implicit elements are not pretty-printed and have no position.- Specified by:
isImplicit
in interfaceCtElement
- Overrides:
isImplicit
in classCtElementImpl
-
getType
Description copied from interface:CtTypedElement
Gets this element's type.- Specified by:
getType
in interfaceCtTypedElement<Object>
-
setType
Description copied from interface:CtTypedElement
Sets this element's type.- Specified by:
setType
in interfaceCtTypedElement<Object>
-
accept
Description copied from interface:CtVisitable
Accepts a visitor- Specified by:
accept
in interfaceCtVisitable
-
setSimpleName
Description copied from interface:CtNamedElement
Sets the simple (unqualified) name of this element.- Specified by:
setSimpleName
in interfaceCtNamedElement
- Overrides:
setSimpleName
in classCtNamedElementImpl
-
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 interfaceCtNamedElement
- Specified by:
clone
in interfaceCtRecordComponent
- Overrides:
clone
in classCtNamedElementImpl
-
isShadow
public boolean isShadow()Description copied from interface:CtShadowable
When 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:
isShadow
in interfaceCtShadowable
- Returns:
- true if the element is a shadow element, otherwise false.
-
setShadow
Description copied from interface:CtShadowable
Marks an element as shadow. To know what is a shadow element, see the javadoc ofCtShadowable.isShadow()
.- Specified by:
setShadow
in interfaceCtShadowable
-