Record Class Implementation<T extends Implementation.ExtensionProvidable>
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.extension.Implementation<T>
- Record Components:
type
- theClass
of the implemented interfacesupplier
- theFunction
used to retrieve instances of the custom implementation
public record Implementation<T extends Implementation.ExtensionProvidable>(@NotNull Class<T extends Implementation.ExtensionProvidable> type, @NotNull Function<@NotNull JDACBuilderData,@NotNull SequencedCollection<@NotNull T extends Implementation.ExtensionProvidable>> supplier)
extends Record
Instances of Implementation
are used to provide custom implementations of Implementation.ExtensionProvidable
interfaces, namely:
ClassFinder
Descriptor
InteractionControllerInstantiator
ErrorMessageFactory
Implementation.MiddlewareContainer
(wrapper type forMiddleware
)Implementation.TypeAdapterContainer
(wrapper type forTypeAdapter
)Implementation.ValidatorContainer
(wrapper type forValidator
)PermissionsProvider
GuildScopeProvider
Such instances of Implementation
are returned by Extension.providedImplementations()
and used by the JDACBuilder
to
configure jda-commands.
Note: If the supplier()
returns an empty collection, then this Implementation
is discarded and thus treated as non-existent.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A marker interface that all types providable by anExtension
share.static final record
A container type for providingMiddleware
s.static final record
A container type for providingTypeAdapter
s.static final record
A container type for providingValidator
s. -
Constructor Summary
ConstructorsConstructorDescriptionImplementation
(@NotNull Class<T> type, @NotNull Function<@NotNull JDACBuilderData, @NotNull SequencedCollection<@NotNull T>> supplier) Creates an instance of aImplementation
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static <T extends Implementation.ExtensionProvidable>
Implementation<T> single
(@NotNull Class<T> type, @NotNull Function<@NotNull JDACBuilderData, @NotNull T> supplier) @NotNull Function
<@NotNull JDACBuilderData, @NotNull SequencedCollection<@NotNull T>> supplier()
Returns the value of thesupplier
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Constructor Details
-
Implementation
public Implementation(@NotNull @NotNull Class<T> type, @NotNull @NotNull Function<@NotNull JDACBuilderData, @NotNull SequencedCollection<@NotNull T>> supplier) Creates an instance of aImplementation
record class.
-
-
Method Details
-
single
public static <T extends Implementation.ExtensionProvidable> Implementation<T> single(@NotNull @NotNull Class<T> type, @NotNull @NotNull Function<@NotNull JDACBuilderData, @NotNull T> supplier) -
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)
. -
type
-
supplier
@NotNull public @NotNull Function<@NotNull JDACBuilderData,@NotNull SequencedCollection<@NotNull T>> supplier()Returns the value of thesupplier
record component.- Returns:
- the value of the
supplier
record component
-