Interface Invokable
- All Superinterfaces:
Definition
- All Known Subinterfaces:
CommandDefinition
,ComponentDefinition<T>
,InteractionDefinition
,SelectMenuDefinition<T>
- All Known Implementing Classes:
AutoCompleteDefinition
,ButtonDefinition
,ContextCommandDefinition
,EntitySelectMenuDefinition
,ModalDefinition
,SlashCommandDefinition
,StringSelectMenuDefinition
Indicates that the implementing
Definition
is bound to a method that can be invoked.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull ClassDescription
TheClassDescription
of the declaring class of themethodDescription()
.default @Nullable Object
invoke
(@NotNull Object instance, @NotNull InvocationContext<?> invocation) Invokes the method that thisDefinition
is bound to.@NotNull MethodDescription
TheMethodDescription
of the method thisDefinition
is bound to.Methods inherited from interface com.github.kaktushose.jda.commands.definitions.Definition
definitionId, displayName
-
Field Details
-
log
static final org.slf4j.Logger log
-
-
Method Details
-
invoke
@Nullable default @Nullable Object invoke(@NotNull @NotNull Object instance, @NotNull @NotNull InvocationContext<?> invocation) throws IllegalAccessException, InvocationTargetException Invokes the method that thisDefinition
is bound to.- Parameters:
instance
- an instance of the declaring class of the methodinvocation
- the correspondingInvocationContext
- Returns:
- the result of the method invocation
- Throws:
IllegalStateException
- if the definition must not be invoked at the moment this method gets calledIllegalAccessException
- if the method object is enforcing Java language access control and the underlying method is inaccessibleInvocationTargetException
- if an exception was thrown by the invoked method or constructor
-
classDescription
TheClassDescription
of the declaring class of themethodDescription()
. -
methodDescription
TheMethodDescription
of the method thisDefinition
is bound to.
-