Package org.omegazero.common.event.task
Class ReflectTask
java.lang.Object
org.omegazero.common.event.task.AbstractTask
org.omegazero.common.event.task.ReflectTask
- All Implemented Interfaces:
Comparable<Task>
,Runnable
,Task
A
Task
based on reflection.- Since:
- 2.6
-
Constructor Summary
ConstructorsConstructorDescriptionReflectTask
(Method method, Object callerInstance, Object[] args) Creates a newReflectTask
.ReflectTask
(Method method, Object callerInstance, Object[] args, int priority) Creates a newReflectTask
. -
Method Summary
Methods inherited from class org.omegazero.common.event.task.AbstractTask
getPriority, run
-
Constructor Details
-
ReflectTask
Creates a newReflectTask
.- Parameters:
method
- The task handler methodcallerInstance
- The instance to call the method with. May benull
if the method is staticargs
- The arguments to pass to the task handler when this task is executed- See Also:
-
ReflectTask
Creates a newReflectTask
.- Parameters:
method
- The task handler methodcallerInstance
- The instance to call the method with. May benull
if the method is staticargs
- The arguments to pass to the task handler when this task is executedpriority
- The priority of this task- See Also:
-
-
Method Details
-
execute
Description copied from class:AbstractTask
Executes this task with the given arguments.- Specified by:
execute
in classAbstractTask
- Parameters:
args
- The arguments to pass to the task handler- Throws:
ReflectiveOperationException
-
getMethod
Returns the task method passed in the constructor.- Returns:
- The method instance
-
getCallerInstance
Returns the callee instance passed in the constructor.- Returns:
- The instance object
-