Record Class InteractionRegistry
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.interactions.InteractionRegistry
public record InteractionRegistry(Validators validators, I18n i18n, LocalizationFunction localizationFunction, Descriptor descriptor, Set<Definition> definitions)
extends Record
Central registry for all
InteractionDefinitions.-
Constructor Summary
ConstructorsConstructorDescriptionInteractionRegistry(Validators registry, I18n i18n, LocalizationFunction function, Descriptor descriptor) Constructs a newInteractionRegistryInteractionRegistry(Validators validators, I18n i18n, LocalizationFunction localizationFunction, Descriptor descriptor, Set<Definition> definitions) Creates an instance of aInteractionRegistryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedefinitionsrecord component.Returns the value of thedescriptorrecord component.final booleanIndicates whether some other object is "equal to" this one.<T extends Definition>
T<T extends Definition>
Collection<T> final inthashCode()Returns a hash code value for this object.i18n()Returns the value of thei18nrecord component.voidindex(Iterable<Class<?>> classes, CommandDefinition.CommandConfig globalCommandConfig) Scans all given classes and registers the interactions defined in them.Returns the value of thelocalizationFunctionrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevalidatorsrecord component.
-
Constructor Details
-
InteractionRegistry
public InteractionRegistry(Validators registry, I18n i18n, LocalizationFunction function, Descriptor descriptor) Constructs a newInteractionRegistry- Parameters:
registry- the correspondingValidatorsi18n- theI18ninstance to usefunction- theLocalizationFunctionto usedescriptor- theDescriptorto use
-
InteractionRegistry
public InteractionRegistry(Validators validators, I18n i18n, LocalizationFunction localizationFunction, Descriptor descriptor, Set<Definition> definitions) Creates an instance of aInteractionRegistryrecord class.- Parameters:
validators- the value for thevalidatorsrecord componenti18n- the value for thei18nrecord componentlocalizationFunction- the value for thelocalizationFunctionrecord componentdescriptor- the value for thedescriptorrecord componentdefinitions- the value for thedefinitionsrecord component
-
-
Method Details
-
index
Scans all given classes and registers the interactions defined in them.- Parameters:
classes- theClasses to build the interactions from
-
find
- Type Parameters:
T- a subtype ofDefinition- Parameters:
type- the type of theDefinitionto findinternalError-trueif theDefinitionmust be found and not finding it indicates a framework bugpredicate- thePredicateused to find theDefinition- Returns:
Tthe definition- Throws:
IllegalStateException- if noDefinitionwas found, although this mandatory should have been the case. This is a rare occasion and can be considered a framework bugIllegalArgumentException- if noDefinitionwas found, because thePredicatedidn't include any elements
-
find
- Type Parameters:
T- a subtype ofDefinition- Parameters:
type- the type of theDefinitionto findpredicate- thePredicateused to find theDefinitions- Returns:
- a possibly-empty
Collectionof allDefinitions that match the givenPredicate - Throws:
IllegalStateException- if noDefinitionwas found, although this mandatory should have been the case. This is a rare occasion and can be considered a framework bugIllegalArgumentException- if noDefinitionwas found, because thePredicatedidn't include any elements
-
toString
-
hashCode
-
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). -
validators
Returns the value of thevalidatorsrecord component.- Returns:
- the value of the
validatorsrecord component
-
i18n
Returns the value of thei18nrecord component.- Returns:
- the value of the
i18nrecord component
-
localizationFunction
Returns the value of thelocalizationFunctionrecord component.- Returns:
- the value of the
localizationFunctionrecord component
-
descriptor
Returns the value of thedescriptorrecord component.- Returns:
- the value of the
descriptorrecord component
-
definitions
Returns the value of thedefinitionsrecord component.- Returns:
- the value of the
definitionsrecord component
-