Interface ExtraArgument

All Known Implementing Classes:
DefaultExtraArgument

public interface ExtraArgument
A representation of an extra, non-option command line argument.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the argument name.
    default int
    Get the allow number of arguments of this type.
    default Class<?>
    Get the type for shell completion purposes.
    boolean
    Get if the argument is required.
    newInstance(String name, boolean required)
    Create a new extra argument instance.
    newInstance(String name, boolean required, Class<?> type)
    Create a new extra argument instance with type information for shell completion.
  • Method Details

    • newInstance

      @NonNull static ExtraArgument newInstance(@NonNull String name, boolean required)
      Create a new extra argument instance.
      Parameters:
      name - the argument name
      required - true if the argument is required, or false otherwise
      Returns:
      the instance
    • newInstance

      @NonNull static ExtraArgument newInstance(@NonNull String name, boolean required, @Nullable Class<?> type)
      Create a new extra argument 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
      Returns:
      the instance
    • getName

      String getName()
      Get the argument name.
      Returns:
      the name
    • isRequired

      boolean isRequired()
      Get if the argument is required.
      Returns:
      true if the argument is required, or false otherwise
    • getNumber

      default int getNumber()
      Get the allow number of arguments of this type.
      Returns:
      the allowed number of arguments as a positive number or -1 for unlimited
    • getType

      @Nullable default Class<?> getType()
      Get the type for shell completion purposes.

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

      Returns:
      the type class used to determine shell completion behavior, or null for freeform input