public interface CommandFunction
Method.| Modifier and Type | Method and Description |
|---|---|
@NotNull AnnotationList |
annotations()
Returns the annotations on the function
|
<T> T |
call(java.lang.Object... arguments)
Calls the function with the given arguments
|
@NotNull MethodCaller.BoundMethodCaller |
caller()
Returns a wrapper that allows to easily invoke the method with its parameters
directly.
|
default <T extends java.lang.annotation.Annotation> |
getAnnotation(@NotNull java.lang.Class<T> type)
Returns the annotation on the function
|
default boolean |
hasAnnotation(@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests whether the function has the specified annotation
|
<A extends CommandActor> |
lamp()
Returns the Lamp instance that created this function.
|
@NotNull java.lang.reflect.Method |
method()
Returns the underlying
Method of this function |
@NotNull java.lang.String |
name()
Returns the function name
|
@NotNull CommandParameter |
parameter(java.lang.String name)
Returns the
CommandParameter that has a given name, otherwise
throws an error. |
@NotNull @Unmodifiable java.util.Map<java.lang.String,CommandParameter> |
parametersByName()
Returns an unmodifiable map of the parameters this function contains.
|
<T> @NotNull ResponseHandler<?,T> |
responseHandler()
Returns the response handler for this function
|
<A extends CommandActor> Lamp<A> lamp()
@NotNull @NotNull java.lang.String name()
@NotNull @NotNull AnnotationList annotations()
@NotNull @NotNull java.lang.reflect.Method method()
Method of this function@NotNull @NotNull @Unmodifiable java.util.Map<java.lang.String,CommandParameter> parametersByName()
Note that the names are the ones generated by ParameterNamingStrategy
or explicitly set with Named, and not Parameter.getName().
@NotNull @NotNull CommandParameter parameter(java.lang.String name)
CommandParameter that has a given name, otherwise
throws an error.name - Name of the parameterjava.util.NoSuchElementException - if no such parameter exists@NotNull @NotNull MethodCaller.BoundMethodCaller caller()
<T> T call(@NotNull
java.lang.Object... arguments)
T - The function return typearguments - Arguments to invoke with@NotNull <T> @NotNull ResponseHandler<?,T> responseHandler()
T - The response typedefault boolean hasAnnotation(@NotNull
@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType - Annotation to check for@Nullable
default <T extends java.lang.annotation.Annotation> T getAnnotation(@NotNull
@NotNull java.lang.Class<T> type)
type - Annotation to check fornull if it's not present.