Class ConfiguredCommand<T extends Configuration>

    • Constructor Detail

      • ConfiguredCommand

        protected ConfiguredCommand​(String name,
                                    String description)
    • Method Detail

      • getConfigurationClass

        protected Class<T> getConfigurationClass()
        Returns the Class of the configuration type.
        Returns:
        the Class of the configuration type
      • getConfiguration

        public @Nullable T getConfiguration()
        Returns the parsed configuration or null if it hasn't been parsed yet.
        Returns:
        Returns the parsed configuration or null if it hasn't been parsed yet
        Since:
        2.0.19
      • configure

        public void configure​(net.sourceforge.argparse4j.inf.Subparser subparser)
        Configure the command's Subparser.

        N.B.: if you override this method, you must call super.override(subparser) in order to preserve the configuration file parameter in the subparser.

        Specified by:
        configure in class Command
        Parameters:
        subparser - the Subparser specific to the command
      • addFileArgument

        protected net.sourceforge.argparse4j.inf.Argument addFileArgument​(net.sourceforge.argparse4j.inf.Subparser subparser)
        Adds the configuration file argument for the configured command.
        Parameters:
        subparser - The subparser to register the argument on
        Returns:
        the register argument
      • run

        public void run​(Bootstrap<?> wildcardBootstrap,
                        net.sourceforge.argparse4j.inf.Namespace namespace)
                 throws Exception
        Description copied from class: Command
        Executes when the user runs this specific command.
        Specified by:
        run in class Command
        Parameters:
        wildcardBootstrap - the bootstrap bootstrap
        namespace - the parsed command line namespace
        Throws:
        Exception - if something goes wrong
      • cleanupAsynchronously

        protected void cleanupAsynchronously()
      • cleanup

        protected void cleanup()
      • run

        protected abstract void run​(Bootstrap<T> bootstrap,
                                    net.sourceforge.argparse4j.inf.Namespace namespace,
                                    T configuration)
                             throws Exception
        Runs the command with the given Bootstrap and Configuration.
        Parameters:
        bootstrap - the bootstrap bootstrap
        namespace - the parsed command line namespace
        configuration - the configuration object
        Throws:
        Exception - if something goes wrong