Record Class Descriptor

java.lang.Object
java.lang.Record
io.gdcc.spi.meta.descriptor.Descriptor
Record Components:
klass - implementation class name
kind - fully qualified base contract name
contracts - map of implemented contract names to API levels. May not contain null keys or values.
requiredProviders - map of required provider names to API levels. May not contain null keys or values.

public record Descriptor(String klass, String kind, Map<String,Integer> contracts, Map<String,Integer> requiredProviders) extends Record
In-memory representation of raw metadata de/serialized from a Dataverse Plugin Metadata file.
  • Constructor Details

    • Descriptor

      public Descriptor(String klass, String kind, Map<String,Integer> contracts, Map<String,Integer> requiredProviders)
      Creates a new plugin and defensively copies the contract/provider maps.

      This ensures the plugin remains immutable even if callers pass in mutable maps. All arguments must be non-null.

      Please note: the provided maps may not contain any null keys or values.

  • Method Details

    • isOfKind

      public boolean isOfKind(String kindFqcn)
      Determines whether this plugin is of a specified base contract kind. Checks both kind and implemented contracts.
      Parameters:
      kindFqcn - the fully qualified class name of the kind to check
      Returns:
      true if the plugin's kind matches the given class name and its contract is implemented, otherwise false
    • isOfKind

      public boolean isOfKind(Class<?> kind)
    • implementsContract

      public boolean implementsContract(String contractFqcn)
      Checks whether this plugin declares the given implemented contract.
      Parameters:
      contractFqcn - the fully qualified contract class name
      Returns:
      true if the contract is present in this plugin
    • implementsContract

      public boolean implementsContract(Class<?> contractClass)
      Checks whether this plugin declares the given implemented contract.
      Parameters:
      contractClass - the contract class
      Returns:
      true if the contract is present in this plugin
    • contractLevel

      public int contractLevel(String contractFqcn)
      Returns the declared API level for the given implemented contract, if present.
      Parameters:
      contractFqcn - the fully qualified contract class name
      Returns:
      the declared API level wrapped in an OptionalInt, or an empty value if absent
    • contractLevel

      public int contractLevel(Class<?> contractClass)
      Returns the declared API level for the given implemented contract, if present.
      Parameters:
      contractClass - the contract class
      Returns:
      the declared API level wrapped in an OptionalInt, or an empty value if absent
    • requiresProvider

      public boolean requiresProvider(String providerFqcn)
      Checks whether this plugin declares the given required provider.
      Parameters:
      providerFqcn - the fully qualified provider class name
      Returns:
      true if the provider is present in this plugin
    • requiresProvider

      public boolean requiresProvider(Class<?> providerClass)
      Checks whether this plugin declares the given required provider.
      Parameters:
      providerClass - the provider class
      Returns:
      true if the provider is present in this plugin
    • requiredProviderLevel

      public int requiredProviderLevel(String providerFqcn)
      Returns the declared required API level for the given provider, if present.
      Parameters:
      providerFqcn - the fully qualified provider class name
      Returns:
      the required provider API level wrapped in an OptionalInt, or an empty value if absent
    • requiredProviderLevel

      public int requiredProviderLevel(Class<?> providerClass)
      Returns the declared required API level for the given provider, if present.
      Parameters:
      providerClass - the provider class
      Returns:
      the required provider API level wrapped in an OptionalInt, or an empty value if absent
    • 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.
    • klass

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

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

      public Map<String,Integer> contracts()
      Returns the value of the contracts record component.
      Returns:
      the value of the contracts record component
    • requiredProviders

      public Map<String,Integer> requiredProviders()
      Returns the value of the requiredProviders record component.
      Returns:
      the value of the requiredProviders record component