Class DefaultExtraArgument

java.lang.Object
dev.metaschema.cli.processor.command.impl.DefaultExtraArgument
All Implemented Interfaces:
ExtraArgument

public class DefaultExtraArgument extends Object implements ExtraArgument
A default implementation of the ExtraArgument interface that represents a named command-line argument which can be marked as required or optional.

This implementation is used by the command processor to handle additional arguments that are not covered by specific command options.

  • Constructor Details

    • DefaultExtraArgument

      public DefaultExtraArgument(@NonNull String name, boolean required)
      Construct a new instance.
      Parameters:
      name - the argument name
      required - true if the argument is required, or false otherwise
    • DefaultExtraArgument

      public DefaultExtraArgument(@NonNull String name, boolean required, @Nullable Class<?> type)
      Construct a new instance with type information for shell completion.
      Parameters:
      name - the argument name
      required - true if the argument is required, or false otherwise
      type - the type class for completion lookup, or null for freeform input
  • Method Details

    • getName

      public String getName()
      Description copied from interface: ExtraArgument
      Get the argument name.
      Specified by:
      getName in interface ExtraArgument
      Returns:
      the name
    • isRequired

      public boolean isRequired()
      Description copied from interface: ExtraArgument
      Get if the argument is required.
      Specified by:
      isRequired in interface ExtraArgument
      Returns:
      true if the argument is required, or false otherwise
    • getType

      @Nullable public Class<?> getType()
      Description copied from interface: ExtraArgument
      Get the type for shell completion purposes.

      The type is used by CompletionTypeRegistry to lookup the appropriate completion behavior for this argument.

      Specified by:
      getType in interface ExtraArgument
      Returns:
      the type class used to determine shell completion behavior, or null for freeform input