Class EnvironmentCommand<T extends Configuration>

Type Parameters:
T - the Configuration subclass which is loaded from the configuration file
Direct Known Subclasses:
ServerCommand

public abstract class EnvironmentCommand<T extends Configuration> extends ConfiguredCommand<T>
A command which executes with a configured Environment.
See Also:
  • Constructor Details

    • EnvironmentCommand

      protected EnvironmentCommand(Application<T> application, String name, String description)
      Creates a new environment command.
      Parameters:
      application - the application providing this command
      name - the name of the command, used for command line invocation
      description - a description of the command's purpose
  • Method Details

    • getEnvironment

      public @Nullable Environment getEnvironment()
      Returns the constructed environment or null if it hasn't been constructed yet.
      Returns:
      Returns the constructed environment or null if it hasn't been constructed yet
      Since:
      2.0.19
    • run

      protected void run(Bootstrap<T> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) throws Exception
      Description copied from class: ConfiguredCommand
      Runs the command with the given Bootstrap and Configuration.
      Specified by:
      run in class ConfiguredCommand<T extends Configuration>
      Parameters:
      bootstrap - the bootstrap
      namespace - the parsed command line namespace
      configuration - the configuration object
      Throws:
      Exception - if something goes wrong
    • run

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