Record Class ClassIndex

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.index.ClassIndex

public record ClassIndex(int version, String timestamp, String classpathHash, List<ClassIndexEntry> entries) extends Record
Class Index - Immutable record representing a pre-built class index 类索引 - 表示预构建类索引的不可变记录

Contains a versioned, timestamped snapshot of all scanned class metadata along with a classpath hash for staleness detection.

包含所有已扫描类元数据的带版本号和时间戳的快照, 以及用于陈旧检测的 classpath 哈希值。

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是 (不可变记录)
Since:
JDK 25, opencode-base-classloader V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Current index format version 当前索引格式版本
    static final String
    Default classpath location for the index file 索引文件在 classpath 上的默认位置
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClassIndex(int version, String timestamp, String classpathHash, List<ClassIndexEntry> entries)
    Create a class index with defensive copy of entries 创建类索引,对条目列表进行防御性拷贝
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the classpathHash record component.
    Returns the value of the entries record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the timestamp record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the version record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CURRENT_VERSION

      public static final int CURRENT_VERSION
      Current index format version 当前索引格式版本
      See Also:
    • INDEX_LOCATION

      public static final String INDEX_LOCATION
      Default classpath location for the index file 索引文件在 classpath 上的默认位置
      See Also:
  • Constructor Details

    • ClassIndex

      public ClassIndex(int version, String timestamp, String classpathHash, List<ClassIndexEntry> entries)
      Create a class index with defensive copy of entries 创建类索引,对条目列表进行防御性拷贝
      Parameters:
      version - index format version | 索引格式版本
      timestamp - creation timestamp in ISO-8601 format | ISO-8601 格式的创建时间戳
      classpathHash - SHA-256 hash of the classpath for staleness detection | 用于陈旧检测的 classpath SHA-256 哈希值
      entries - list of class index entries | 类索引条目列表
  • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • version

      public int version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • timestamp

      public String timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • classpathHash

      public String classpathHash()
      Returns the value of the classpathHash record component.
      Returns:
      the value of the classpathHash record component
    • entries

      public List<ClassIndexEntry> entries()
      Returns the value of the entries record component.
      Returns:
      the value of the entries record component