Package io.gdcc.spi.meta.descriptor
Record Class Descriptor
java.lang.Object
java.lang.Record
io.gdcc.spi.meta.descriptor.Descriptor
- Record Components:
klass- implementation class namekind- fully qualified base contract namecontracts- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcontractLevel(Class<?> contractClass) Returns the declared API level for the given implemented contract, if present.intcontractLevel(String contractFqcn) Returns the declared API level for the given implemented contract, if present.Returns the value of thecontractsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanimplementsContract(Class<?> contractClass) Checks whether this plugin declares the given implemented contract.booleanimplementsContract(String contractFqcn) Checks whether this plugin declares the given implemented contract.booleanbooleanDetermines whether this plugin is of a specified base contract kind.kind()Returns the value of thekindrecord component.klass()Returns the value of theklassrecord component.intrequiredProviderLevel(Class<?> providerClass) Returns the declared required API level for the given provider, if present.intrequiredProviderLevel(String providerFqcn) Returns the declared required API level for the given provider, if present.Returns the value of therequiredProvidersrecord component.booleanrequiresProvider(Class<?> providerClass) Checks whether this plugin declares the given required provider.booleanrequiresProvider(String providerFqcn) Checks whether this plugin declares the given required provider.final StringtoString()Returns a string representation of this record class.
-
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
Determines whether this plugin is of a specified base contract kind. Checks bothkindand implementedcontracts.- Parameters:
kindFqcn- the fully qualified class name of the kind to check- Returns:
trueif the plugin's kind matches the given class name and its contract is implemented, otherwisefalse
-
isOfKind
-
implementsContract
Checks whether this plugin declares the given implemented contract.- Parameters:
contractFqcn- the fully qualified contract class name- Returns:
trueif the contract is present in this plugin
-
implementsContract
Checks whether this plugin declares the given implemented contract.- Parameters:
contractClass- the contract class- Returns:
trueif the contract is present in this plugin
-
contractLevel
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
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
Checks whether this plugin declares the given required provider.- Parameters:
providerFqcn- the fully qualified provider class name- Returns:
trueif the provider is present in this plugin
-
requiresProvider
Checks whether this plugin declares the given required provider.- Parameters:
providerClass- the provider class- Returns:
trueif the provider is present in this plugin
-
requiredProviderLevel
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
klass
Returns the value of theklassrecord component.- Returns:
- the value of the
klassrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
contracts
Returns the value of thecontractsrecord component.- Returns:
- the value of the
contractsrecord component
-
requiredProviders
Returns the value of therequiredProvidersrecord component.- Returns:
- the value of the
requiredProvidersrecord component
-