Record Class PluginContext

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.plugin.PluginContext
Record Components:
pluginId - the unique plugin identifier | 唯一的插件标识符
descriptor - the plugin descriptor | 插件描述符

public record PluginContext(String pluginId, PluginDescriptor descriptor) extends Record
Immutable plugin context passed to plugins during lifecycle callbacks 在生命周期回调期间传递给插件的不可变插件上下文

Contains the plugin identity and descriptor information needed by a Plugin during its Plugin.onStart(PluginContext) callback.

包含 PluginPlugin.onStart(PluginContext) 回调期间 所需的插件身份和描述符信息。

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

    • PluginContext

      public PluginContext(String pluginId, PluginDescriptor descriptor)
      Create a new PluginContext with null validation 创建带空值校验的新 PluginContext
      Parameters:
      pluginId - the unique plugin identifier, must not be null | 唯一的插件标识符,不能为 null
      descriptor - the plugin descriptor, must not be null | 插件描述符,不能为 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.
    • pluginId

      public String pluginId()
      Returns the value of the pluginId record component.
      Returns:
      the value of the pluginId record component
    • descriptor

      public PluginDescriptor descriptor()
      Returns the value of the descriptor record component.
      Returns:
      the value of the descriptor record component