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 TypeMethodDescriptionTheClassDescriptionof the declaring class of themethodDescription().default @Nullable Objectinvoke(Object instance, InvocationContext<?> invocation) Invokes the method that thisDefinitionis bound to.TheMethodDescriptionof the method thisDefinitionis bound to.Methods inherited from interface Definition
definitionId, displayName
-
Field Details
-
log
static final org.slf4j.Logger log
-
-
Method Details
-
invoke
default @Nullable Object invoke(Object instance, InvocationContext<?> invocation) throws IllegalAccessException, InvocationTargetException Invokes the method that thisDefinitionis 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
ClassDescription classDescription()TheClassDescriptionof the declaring class of themethodDescription(). -
methodDescription
MethodDescription methodDescription()TheMethodDescriptionof the method thisDefinitionis bound to.
-