Record Class InteractionRegistry
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.InteractionRegistry
public record InteractionRegistry(@NotNull DependencyInjector dependencyInjector, @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validators, @NotNull LocalizationFunction localizationFunction, @NotNull Descriptor descriptor, @NotNull Set<Definition> definitions)
extends Record
Central registry for all
InteractionDefinition
s.-
Constructor Summary
ConstructorDescriptionInteractionRegistry
(@NotNull DependencyInjector dependencyInjector, @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validators, @NotNull LocalizationFunction localizationFunction, @NotNull Descriptor descriptor, @NotNull Set<Definition> definitions) Creates an instance of aInteractionRegistry
record class.InteractionRegistry
(DependencyInjector injector, com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators registry, LocalizationFunction function, Descriptor descriptor) Constructs a newInteractionRegistry
-
Method Summary
Modifier and TypeMethodDescription@NotNull Set
<Definition> Returns the value of thedefinitions
record component.@NotNull DependencyInjector
Returns the value of thedependencyInjector
record component.@NotNull Descriptor
Returns the value of thedescriptor
record component.final boolean
Indicates whether some other object is "equal to" this one.<T extends Definition>
T<T extends Definition>
Collection<T> final int
hashCode()
Returns a hash code value for this object.void
Scans all given classes and registers the interactions defined in them.@NotNull LocalizationFunction
Returns the value of thelocalizationFunction
record component.final String
toString()
Returns a string representation of this record class.@NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators
Returns the value of thevalidators
record component.
-
Constructor Details
-
InteractionRegistry
public InteractionRegistry(DependencyInjector injector, com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators registry, LocalizationFunction function, Descriptor descriptor) Constructs a newInteractionRegistry
- Parameters:
injector
- theDependencyInjector
to useregistry
- the correspondingValidators
function
- theLocalizationFunction
to usedescriptor
- theDescriptor
to use
-
InteractionRegistry
public InteractionRegistry(@NotNull @NotNull DependencyInjector dependencyInjector, @NotNull @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validators, @NotNull @NotNull LocalizationFunction localizationFunction, @NotNull @NotNull Descriptor descriptor, @NotNull @NotNull Set<Definition> definitions) Creates an instance of aInteractionRegistry
record class.- Parameters:
dependencyInjector
- the value for thedependencyInjector
record componentvalidators
- the value for thevalidators
record componentlocalizationFunction
- the value for thelocalizationFunction
record componentdescriptor
- the value for thedescriptor
record componentdefinitions
- the value for thedefinitions
record component
-
-
Method Details
-
index
-
find
- Type Parameters:
T
- a subtype ofDefinition
- Parameters:
type
- the type of theDefinition
to findinternalError
-true
if theDefinition
must be found and not finding it indicates a framework bugpredicate
- thePredicate
used to find theDefinition
- Returns:
InteractionRegistry
- Throws:
IllegalStateException
- if noDefinition
was found, although this mandatory should have been the case. This is a rare occasion and can be considered a framework bugIllegalArgumentException
- if noDefinition
was found, because thePredicate
didn't include any elements
-
find
- Type Parameters:
T
- a subtype ofDefinition
- Parameters:
type
- the type of theDefinition
to find indicates a framework bugpredicate
- thePredicate
used to find theDefinition
s- Returns:
- a possibly-empty
Collection
of allDefinition
s that match the givenPredicate
- Throws:
IllegalStateException
- if noDefinition
was found, although this mandatory should have been the case. This is a rare occasion and can be considered a framework bugIllegalArgumentException
- if noDefinition
was found, because thePredicate
didn'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)
. -
dependencyInjector
Returns the value of thedependencyInjector
record component.- Returns:
- the value of the
dependencyInjector
record component
-
validators
@NotNull public @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validators()Returns the value of thevalidators
record component.- Returns:
- the value of the
validators
record component
-
localizationFunction
Returns the value of thelocalizationFunction
record component.- Returns:
- the value of the
localizationFunction
record component
-
descriptor
Returns the value of thedescriptor
record component.- Returns:
- the value of the
descriptor
record component
-
definitions
Returns the value of thedefinitions
record component.- Returns:
- the value of the
definitions
record component
-