Class InitFlag

All Implemented Interfaces:
Cloneable, Comparable<Operand<?>>, MatchCountAccessor, Operand<Boolean>, Option<Boolean>, ParsedArgsAccessor, Synopsisable, Term, org.refcodes.exception.ExceptionAccessor<ArgsSyntaxException>, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.Clonable, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.EnabledAccessor, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, org.refcodes.mixin.TypeAccessor<Boolean>, org.refcodes.mixin.ValueAccessor<Boolean>

public class InitFlag extends Flag
A predefined init Flag: A predefined Flag gives its SHORT_OPTION, its LONG_OPTION as well as its ALIAS an according semantics regarded by other subsystems.
  • Field Details

  • Constructor Details

    • InitFlag

      public InitFlag()
      Constructs the predefined init Flag.
    • InitFlag

      public InitFlag(boolean hasShortOption)
      Constructs the predefined init Flag.
      Parameters:
      hasShortOption - True in case to also enable the short option, else only the long option takes effect.
    • InitFlag

      public InitFlag(String aDescription)
      Constructs the predefined init Flag.
      Parameters:
      aDescription - The description to be used (without any line breaks).
    • InitFlag

      public InitFlag(String aDescription, boolean hasShortOption)
      Constructs the predefined init Flag.
      Parameters:
      aDescription - The description to be used (without any line breaks).
      hasShortOption - True in case to also enable the short option, else only the long option takes effect.
  • Method Details

    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.refcodes.mixin.DescriptionAccessor
    • getException

      public ArgsSyntaxException getException()
      Retrieves the ArgsSyntaxException exception in case invoking Term.parseArgs(String[], CliContext) failed. The exception (and the according suppressed ones alongside the causes) does not necessarily have been thrown by the Term.parseArgs(String[], CliContext) method depending on the semantics of the Term handing the exception (the AnyCondition provides any exceptions it caught even though it did not throw them as of its semantics).
      Specified by:
      getException in interface org.refcodes.exception.ExceptionAccessor<ArgsSyntaxException>
      Specified by:
      getException in interface Term
      Returns:
      The ArgsSyntaxException exception occurring while parsing the arguments.
    • toArgsDiff

      protected static String[] toArgsDiff(String[] aArgs, List<? extends Operand<?>> aArgsSubset)
      Creates the difference between the provided set and the provided Lists therein found argument arrays subset (as of Operand.getParsedArgs()).
      Parameters:
      aArgs - The set to be used for the diff operation.
      aArgsSubset - The subset to be used for the diff operation being the lists containing the Operand instances whose command line arguments are to be diffed.
      Returns:
      The difference between the set and the subset.
    • toArgsDiff

      protected static String[] toArgsDiff(String[] aArgs, Operand<?>[] aArgsSubset)
      Creates the difference between the provided set and the provided Lists therein found argument arrays subset (as of Operand.getParsedArgs()).
      Parameters:
      aArgs - The set to be used for the diff operation.
      aArgsSubset - The subset to be used for the diff operation being the lists containing the Operand instances whose command line arguments are to be diffed.
      Returns:
      The difference between the set and the subset.
    • toArgsDiff

      protected static String[] toArgsDiff(String[] aArgs, String[] aArgsSubset)
      Creates the difference between the provided set and the provided subset.
      Parameters:
      aArgs - The set to be used for the diff operation.
      aArgsSubset - The subset to be used for the diff operation.
      Returns:
      The difference between the set and the subset.
    • toParsedArgs

      protected static String[] toParsedArgs(Operand<?>[]... aOperands)
      Takes all Operand instances found in the provided Lists and adds all therein found argument arrays (as of Operand.getParsedArgs()) to the result.
      Parameters:
      aOperands - The lists containing the Operand instances whose command line arguments are to be added to the result.
      Returns:
      All the command line arguments detected in the provided Operands Lists.