public class RecordComponentNode
extends AnnotatedNode
Represents a component (field) of a record class definition introduced in Java 16.
Record components provide immutable fields with automatic generation of accessor methods,
constructor parameters, and equals()/hashCode()/toString() implementations.
Each component maintains its type and any annotations applied to it.
| Constructor and description |
|---|
RecordComponentNode(ClassNode declaringClass, String name, ClassNode type)Creates a record component with the specified name and type. |
RecordComponentNode(ClassNode declaringClass, String name, ClassNode type, List<AnnotationNode> annotations)Creates a record component with the specified name, type, and annotations. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
equals(Object o)Compares this record component with another object for equality. |
|
public String |
getName()Returns the name of this record component. |
|
public ClassNode |
getType()Returns the type of this record component. |
|
public int |
hashCode()Returns the hash code for this record component based on its name and declaring class. |
| Methods inherited from class | Name |
|---|---|
class AnnotatedNode |
addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode |
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
Creates a record component with the specified name and type.
Creates a record component with the specified name, type, and annotations. Annotations are applied to this component in the order provided.
declaringClass - the ClassNode that declares this record componentname - the name of the record component (never null)type - the ClassNode representing the component's type (never null)annotations - a list of AnnotationNodes to attach to this componentCompares this record component with another object for equality. Two components are equal if they have the same name and belong to the same declaring class.
o - the object to compare withReturns the name of this record component.
Returns the type of this record component.
Returns the hash code for this record component based on its name and declaring class.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.