Record Class PluginHandle<T extends Plugin>

java.lang.Object
java.lang.Record
io.gdcc.spi.core.loader.PluginHandle<T>
Type Parameters:
T - the type of the plugin instance, which must extend Plugin
Record Components:
descriptor - the runtime descriptor containing metadata and implementation details about the plugin; must not be null
plugin - the actual plugin instance associated with the descriptor; must not be null

public record PluginHandle<T extends Plugin>(PluginDescriptor<T extends Plugin> descriptor, T extends Plugin plugin) extends Record
Encapsulates a plugin and its corresponding descriptor, providing a unified representation of a resolved plugin and its metadata in the runtime context.

The PluginHandle is an immutable record that binds a concrete plugin instance with its associated PluginDescriptor. This ensures both the metadata and the operational plugin instance are accessible and linked together, facilitating plugin management and execution.

  • Constructor Details

    • PluginHandle

      public PluginHandle(PluginDescriptor<T> descriptor, T plugin)
      Creates an instance of a PluginHandle record class.
      Parameters:
      descriptor - the value for the descriptor record component
      plugin - the value for the plugin record component
  • 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.
    • descriptor

      public PluginDescriptor<T> descriptor()
      Returns the value of the descriptor record component.
      Returns:
      the value of the descriptor record component
    • plugin

      public T plugin()
      Returns the value of the plugin record component.
      Returns:
      the value of the plugin record component