Record Class PluginDescriptor

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.plugin.PluginDescriptor
Record Components:
id - the unique plugin identifier | 唯一的插件标识符
name - the human-readable plugin name | 人类可读的插件名称
version - the plugin version string | 插件版本字符串
mainClass - the fully qualified name of the Plugin implementation | Plugin 实现的完全限定类名
jarPath - the path to the plugin JAR file | 插件 JAR 文件的路径

public record PluginDescriptor(String id, String name, String version, String mainClass, Path jarPath) extends Record
Immutable plugin descriptor loaded from META-INF/opencode/plugin.properties 从 META-INF/opencode/plugin.properties 加载的不可变插件描述符

Contains all metadata needed to identify and load a plugin: id, name, version, main class, and JAR path.

包含标识和加载插件所需的所有元数据: ID、名称、版本、主类和 JAR 路径。

Properties format | 属性文件格式:

plugin.id=auth-plugin
plugin.name=Authentication Plugin
plugin.version=1.0.0
plugin.mainClass=com.example.AuthPlugin

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是 (不可变 record)
  • Null-safe: Yes (constructor validates) - 空值安全: 是 (构造器校验)
Since:
JDK 25, opencode-base-classloader V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • PluginDescriptor

      public PluginDescriptor(String id, String name, String version, String mainClass, Path jarPath)
      Create a new PluginDescriptor with null validation 创建带空值校验的新 PluginDescriptor
      Parameters:
      id - the unique plugin identifier, must not be null | 唯一的插件标识符,不能为 null
      name - the human-readable plugin name, must not be null | 人类可读的插件名称,不能为 null
      version - the plugin version string, must not be null | 插件版本字符串,不能为 null
      mainClass - the fully qualified plugin main class, must not be null | 完全限定的插件主类名,不能为 null
      jarPath - the path to the plugin JAR, must not be null | 插件 JAR 的路径,不能为 null
      Throws:
      NullPointerException - if any parameter is null | 当任何参数为 null 时
  • 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.
    • id

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

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

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • mainClass

      public String mainClass()
      Returns the value of the mainClass record component.
      Returns:
      the value of the mainClass record component
    • jarPath

      public Path jarPath()
      Returns the value of the jarPath record component.
      Returns:
      the value of the jarPath record component