Package spoon.reflect.declaration
Interface CtRecordComponent
- All Superinterfaces:
Cloneable,CtElement,CtNamedElement,CtQueryable,CtShadowable,CtTypedElement<Object>,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Implementing Classes:
CtRecordComponentImpl
This element represents a record component.
Example:
// x is a record component
record Point(int x) {
}
-
Method Summary
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, updateAllParentsBelowMethods inherited from interface spoon.reflect.declaration.CtNamedElement
getReference, getSimpleName, setSimpleNameMethods 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
getType, setTypeMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
toMethod
CtMethod<?> toMethod()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.- Returns:
- the method corresponding to the component (a getter) as a view.
-
toField
CtField<?> toField()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.- Returns:
- the field corresponding to the component as a view.
-
clone
CtRecordComponent 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
-