diff options
author | Dico Karssiens <dico.karssiens@gmail.com> | 2018-09-30 17:05:42 +0100 |
---|---|---|
committer | Dico Karssiens <dico.karssiens@gmail.com> | 2018-09-30 17:05:42 +0100 |
commit | c4801757a2fda147e1cee65f70f80fb215047525 (patch) | |
tree | cc19a113ede79396b56b0adb0ebdb12d63613e2f /dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java | |
parent | 7f36b6f561e17fa76c184053d46254faff69142b (diff) |
Some changes
Diffstat (limited to 'dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java')
-rw-r--r-- | dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java b/dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java new file mode 100644 index 0000000..67b65e4 --- /dev/null +++ b/dicore3/command/src/main/java/io/dico/dicore/command/registration/reflect/ICommandInterceptor.java @@ -0,0 +1,36 @@ +package io.dico.dicore.command.registration.reflect; + +import io.dico.dicore.command.ExecutionContext; + +import java.lang.reflect.Method; + +public interface ICommandInterceptor { + + /** + * Get the receiver of the command, if applicable. + * A command has a receiver if its first parameter implements {@link ICommandReceiver} + * and its instance object implements this interface. + * + * @param context the context of execution + * @param target the method of the command + * @param cmdName the name of the command + * @return the receiver + */ + default ICommandReceiver getReceiver(ExecutionContext context, Method target, String cmdName) { + return null; + } + + /** + * If applicable, get the coroutine context to use in suspend functions (Kotlin only). + * The return type is object to avoid depending on the kotlin runtime. + * + * @param context the context of execution + * @param target the method of the command + * @param cmdName the name of the command + * @return the coroutine context + */ + default Object getCoroutineContext(ExecutionContext context, Method target, String cmdName) { + return null; + } + +} |