Record Class CyclicDependency

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.dependency.CyclicDependency
Record Components:
cyclePath - ordered list of class names forming a cycle (last depends on first) | 形成循环的类名有序列表(最后一个依赖于第一个)

public record CyclicDependency(List<String> cyclePath) extends Record
Cyclic Dependency - Represents a dependency cycle among classes 循环依赖 - 表示类之间的依赖循环

Holds an ordered list of class names forming a cycle, where the last element depends on the first.

持有形成循环的类名有序列表,其中最后一个元素依赖于第一个。

Features | 主要功能:

  • Immutable record with defensive copy - 不可变记录,使用防御性复制
  • Ordered cycle path - 有序的循环路径

Usage Examples | 使用示例:

CyclicDependency cycle = new CyclicDependency(List.of("A", "B", "C"));
// A → B → C → A

Security | 安全性:

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

    • CyclicDependency

      public CyclicDependency(List<String> cyclePath)
      Canonical constructor with null check and defensive copy. 规范构造器,包含空值检查和防御性复制。
      Parameters:
      cyclePath - the cycle path | 循环路径
  • 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.
    • cyclePath

      public List<String> cyclePath()
      Returns the value of the cyclePath record component.
      Returns:
      the value of the cyclePath record component