Record Class ComponentInventory.Component

java.lang.Object
java.lang.Record
com.darkcollective.relix.semantic.internal.ComponentInventory.Component
Record Components:
name - what it calls itself — a library's name, a solver's, a connector's type token, a driver's class
kind - what sort of thing it is: engine, facade, function-library, connector, solver, driver
version - its version, or unknown where the runtime cannot say — a provider on the class path often carries no version at all, and naming it is the answer that matters
Enclosing interface:
ComponentInventory

public static record ComponentInventory.Component(String name, String kind, String version) extends Record
One installed thing.
  • Field Details

    • UNKNOWN

      public static final String UNKNOWN
      The version reported when nothing in the runtime knows one.
      See Also:
  • Constructor Details

    • Component

      public Component(String name, String kind, String version)
      Creates an instance of a Component record class.
      Parameters:
      name - the value for the name record component
      kind - the value for the kind record component
      version - the value for the version record component
  • Method Details

    • of

      public static ComponentInventory.Component of(String name, String kind, Class<?> owner)
      The component a class belongs to, versioned as well as the runtime allows.

      Tries the module descriptor first and the package's implementation version second, because the two are populated by different packagings — a modular image has the first, an ordinary jar the second, and a plain class path neither. Reporting UNKNOWN is the honest third case.

      Parameters:
      name - the component's name
      kind - the component's kind
      owner - a class belonging to it
      Returns:
      the component
    • 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.
    • name

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

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

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