io.vertx.core.spi.launcher

## Class DefaultCommandFactory<C extends Command>

- java.lang.Object
- - io.vertx.core.spi.launcher.DefaultCommandFactory<C>

- All Implemented Interfaces:
    CommandFactory<C>

      public class DefaultCommandFactory<C extends Command>
      extends Object
      implements CommandFactory<C>

  Default implementation of `CommandFactory`. This implementation defines the `CLI` from the given `Command` implementation (by reading the annotation). Then, `Command` instance are created by calling an empty constructor on the given `Command` implementation.
  Author:
    Clement Escoffier

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCommandFactory(Class<C> clazz)` Deprecated. Please use `DefaultCommandFactory(Class, Supplier)`
    `DefaultCommandFactory(Class<C> clazz, java.util.function.Supplier<C> supplier)` Creates a new `CommandFactory`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `C` | `create(CommandLine cl)`
    `CLI` | `define()` Creates a new `CLI` instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultCommandFactory

          @Deprecated
          public DefaultCommandFactory(Class<C> clazz)

      Deprecated. Please use `DefaultCommandFactory(Class, Supplier)`
      Creates a new `CommandFactory`.
      Parameters:
        `clazz` - the `Command` implementation

    - #### DefaultCommandFactory

          public DefaultCommandFactory(Class<C> clazz,
                                       java.util.function.Supplier<C> supplier)

      Creates a new `CommandFactory`.
      Parameters:
        `clazz` - the `Command` implementation
        `supplier` - the `Command` implementation

  - ### Method Detail

    - #### create

          public C create(CommandLine cl)

      Specified by:
        `create` in interface `CommandFactory<C extends Command>`
      Returns:
        a new instance of the command by invoking the default constructor of the given class.

    - #### define

          public CLI define()

      Description copied from interface: `CommandFactory`
      Creates a new `CLI` instance.
      Specified by:
        `define` in interface `CommandFactory<C extends Command>`
      Returns:
        the `CLI` instance by reading the annotation.

Copyright © 2021 Eclipse. All rights reserved.