Interface Directive<T>

Type Parameters:
T - The generic type of the Directive's value.
All Superinterfaces:
AliasAccessor, Clonable, Cloneable, Comparable<Operand<?>>, DescriptionAccessor, Diagnosable, ExceptionAccessor<ArgsSyntaxException>, MatchCountAccessor, Operand<T>, OperationAccessor, ParsedArgsAccessor, Resetable, Schemable<DiagnosticOptions>, Synopsisable, Term, TypeAccessor<T>, ValueAccessor<T>, VisibleAccessor, VisibleAccessor.VisibleBuilder<Term>, VisibleAccessor.VisibleMutator, VisibleAccessor.VisibleProperty
All Known Implementing Classes:
AbstractDirective, ArrayDirective, BooleanDirective, CharDirective, DoubleDirective, EnumDirective, FileDirective, FloatDirective, IntDirective, LongDirective, StringDirective

public interface Directive<T> extends Operand<T>, OperationAccessor
An Directive represents a command line operation with the according operation's operand (value). An Directive can be seen as a key/value(s) pair usually represented by two succeeding arguments (e.g. "open someFile". A Directive has a state which changes with each invocation of the Term.parseArgs(String[], String[], CliContext) method.
  • Method Details

    • getOperation

      String getOperation()
      Returns the operation assigned to the Directive instance.
      Specified by:
      getOperation in interface OperationAccessor
      Returns:
      The operation's String.
    • toKeywords

      default String[] toKeywords(CliContext aCliCtx)
      Produces the keywords (short and/or long options, operations, commands, whatever) with the according prefix (if any) to be considered when overall parsing the command line arguments.
      Specified by:
      toKeywords in interface Operand<T>
      Parameters:
      aCliCtx - The CliContext to use when assembling the keywords.
      Returns:
      The keywords with the according prefix.
    • toUsage

      default String toUsage(CliContext aCliCtx)
      Creates a plain usage specification without any escape codes, helpful e.g. in human readable messages.
      Specified by:
      toUsage in interface Operand<T>
      Parameters:
      aCliCtx - The CliContext to use when creating a beautiful usage text.
      Returns:
      The according usage text.
    • toSpec

      default String toSpec(CliContext aCliCtx)
      Creates a specification including its arguments.

      A specification differs from a syntax in that the specification provides the full definition not omitting any choices whereas the syntax only provides a syntactically correct variant. For example, having an option with a short option and a long option, the specification will show the short option and the long option whereas the syntax will only show either the short option or, if no short option is set, the long option.

      Specified by:
      toSpec in interface Operand<T>
      Parameters:
      aCliCtx - The CliContext to use when creating a beautiful specification text.
      Returns:
      The according specification text.
    • toSyntax

      default String toSyntax(CliContext aCliCtx)
      Creates a syntax including its arguments.

      A specification differs from a syntax in that the specification provides the full definition not omitting any choices whereas the syntax only provides a syntactically correct variant. For example, having an option with a short option and a long option, the specification will show the short option and the long option whereas the syntax will only show either the short option or, if no short option is set, the long option.

      Specified by:
      toSyntax in interface Operand<T>
      Specified by:
      toSyntax in interface Term
      Parameters:
      aCliCtx - The CLI context controlling notation and formatting
      Returns:
      The human readable command line syntax