Record Class RecordComponentMetadata

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.metadata.RecordComponentMetadata

public record RecordComponentMetadata(String name, String type, String genericType, List<AnnotationMetadata> annotations) extends Record
Record Component Metadata - Immutable record component information Record 组件元数据 - 不可变的 Record 组件信息

Represents metadata of a record component, including name, type, generic type and annotations.

表示 Record 组件的元数据,包括名称、类型、泛型类型和注解。

Features | 主要功能:

  • Component name and type - 组件名称和类型
  • Generic type information - 泛型类型信息
  • Annotation information - 注解信息

Usage Examples | 使用示例:

RecordComponentMetadata component = classMetadata.getRecordComponents().get(0);
String name = component.name();
String type = component.type();
String genericType = component.genericType();
List<AnnotationMetadata> annotations = component.annotations();

Security | 安全性:

  • Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-classloader V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • RecordComponentMetadata

      public RecordComponentMetadata(String name, String type, String genericType, List<AnnotationMetadata> annotations)
      Compact constructor with defensive copying and null checks 紧凑构造器,进行防御性拷贝和空值校验
      Parameters:
      name - component name | 组件名称
      type - component type | 组件类型
      genericType - generic type | 泛型类型
      annotations - component annotations | 组件注解
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • genericType

      public String genericType()
      Returns the value of the genericType record component.
      Returns:
      the value of the genericType record component
    • annotations

      public List<AnnotationMetadata> annotations()
      Returns the value of the annotations record component.
      Returns:
      the value of the annotations record component