Class ReflectTask

java.lang.Object
org.omegazero.common.event.task.AbstractTask
org.omegazero.common.event.task.ReflectTask
All Implemented Interfaces:
Comparable<Task>, Runnable, Task

public class ReflectTask extends AbstractTask
A Task based on reflection.
Since:
2.6
  • Constructor Details

    • ReflectTask

      public ReflectTask(Method method, Object callerInstance, Object[] args)
      Creates a new ReflectTask.
      Parameters:
      method - The task handler method
      callerInstance - The instance to call the method with. May be null if the method is static
      args - The arguments to pass to the task handler when this task is executed
      See Also:
    • ReflectTask

      public ReflectTask(Method method, Object callerInstance, Object[] args, int priority)
      Creates a new ReflectTask.
      Parameters:
      method - The task handler method
      callerInstance - The instance to call the method with. May be null if the method is static
      args - The arguments to pass to the task handler when this task is executed
      priority - The priority of this task
      See Also:
  • Method Details

    • execute

      public void execute(Object[] args) throws ReflectiveOperationException
      Description copied from class: AbstractTask
      Executes this task with the given arguments.
      Specified by:
      execute in class AbstractTask
      Parameters:
      args - The arguments to pass to the task handler
      Throws:
      ReflectiveOperationException
    • getMethod

      public Method getMethod()
      Returns the task method passed in the constructor.
      Returns:
      The method instance
    • getCallerInstance

      public Object getCallerInstance()
      Returns the callee instance passed in the constructor.
      Returns:
      The instance object