Class CommandModule

    • Method Detail

      • getCommand

        public Command getCommand()
        Gets the command instance handled by this module.
      • getInfo

        public CommandInfo getInfo()
        Description copied from interface: Module
        Gets metadata about this module.
        Specified by:
        getInfo in interface Module
      • getDelegateObject

        public Object getDelegateObject()
        Description copied from interface: Module
        Gets the object containing the module's actual implementation. By definition, this is an object whose fully qualified class name is given by getInfo().getDelegateClassName(). This object must possess all callback methods specified by ModuleItem.getCallback().

        The nature of this method is implementation-specific; e.g., a CommandModule will return its associated Command. For modules that are not plugins, the result may be something else. If you are implementing this interface directly, a good rule of thumb is to return this.

        Specified by:
        getDelegateObject in interface Module
        Overrides:
        getDelegateObject in class AbstractModule
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • isCanceled

        public boolean isCanceled()
        Description copied from interface: Cancelable
        Gets whether the operation has been canceled.
        Specified by:
        isCanceled in interface Cancelable
      • cancel

        public void cancel​(String reason)
        Description copied from interface: Cancelable
        Cancels the operation execution, with the given reason for doing so.

        This method merely sets the operation status to canceled; it cannot necessarily stop the operation itself. That is, it is the responsibility of each individual operation to check Cancelable.isCanceled() in a timely manner during execution, and stop doing whatever it is doing if the flag has been tripped.

        Specified by:
        cancel in interface Cancelable
        Parameters:
        reason - A message describing why the operation is being canceled.
      • getCancelReason

        public String getCancelReason()
        Description copied from interface: Cancelable
        Gets a message describing why the operation was canceled.
        Specified by:
        getCancelReason in interface Cancelable
        Returns:
        The reason for cancelation, which may be null if no reason was given, or if the operation was not in fact canceled.
      • setContext

        public void setContext​(Context context)
        Description copied from interface: Contextual
        Sets the application context to which the object belongs.

        Typically this method simply delegates to Context.inject(Object), and should be called only once to populate the context. Most contextual objects do not support later alteration of the context, and will throw IllegalStateException if this method is invoked again.

        Specified by:
        setContext in interface Contextual
        See Also:
        Context.inject(Object)