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 TypeMethodDescriptionvoidAccepts a visitorclone()Clone the element which calls this method in a new object.getType()Gets this element's type.booleanReturns true if this element is not present in the code (automatically added by the Java compiler or inferred when the model is built).booleanisShadow()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, getSimpleNameMethods 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, updateAllParentsBelowMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, updateAllParentsBelowMethods inherited from interface spoon.reflect.declaration.CtNamedElement
getReference, getSimpleNameMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtRecordComponentImpl
public CtRecordComponentImpl()
-
-
Method Details
-
toMethod
Description copied from interface:CtRecordComponentConverts 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:
toMethodin interfaceCtRecordComponent- Returns:
- the method corresponding to the component (a getter) as a view.
-
toField
Description copied from interface:CtRecordComponentConverts 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:
toFieldin interfaceCtRecordComponent- Returns:
- the field corresponding to the component as a view.
-
isImplicit
public boolean isImplicit()Description copied from interface:CtElementReturns 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:
isImplicitin interfaceCtElement- Overrides:
isImplicitin classCtElementImpl
-
getType
Description copied from interface:CtTypedElementGets this element's type.- Specified by:
getTypein interfaceCtTypedElement<Object>
-
setType
Description copied from interface:CtTypedElementSets this element's type.- Specified by:
setTypein interfaceCtTypedElement<Object>
-
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 interfaceCtNamedElement- Overrides:
setSimpleNamein classCtNamedElementImpl
-
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 interfaceCtNamedElement- Specified by:
clonein interfaceCtRecordComponent- Overrides:
clonein classCtNamedElementImpl
-
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
-