Class StringOperand

All Implemented Interfaces:
Cloneable, Comparable<Operand<?>>, MatchCountAccessor, Operand<String>, ParsedArgsAccessor, Synopsisable, Term, org.refcodes.exception.ExceptionAccessor<ArgsSyntaxException>, org.refcodes.graphical.VisibleAccessor, org.refcodes.graphical.VisibleAccessor.VisibleBuilder<Term>, org.refcodes.graphical.VisibleAccessor.VisibleMutator, org.refcodes.graphical.VisibleAccessor.VisibleProperty, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.Clonable, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.Resetable, org.refcodes.mixin.TypeAccessor<String>, org.refcodes.mixin.ValueAccessor<String>, org.refcodes.schema.Schemable

public class StringOperand extends AbstractOperand<String>
An Operand (neither a short option nor a long option prepended nor being a switch) being s String. An Operand stands by itself and represents itself.
  • Field Details

    • _description

      protected String _description
    • _exception

      protected ArgsSyntaxException _exception
    • _isVisible

      protected boolean _isVisible
  • Constructor Details

    • StringOperand

      public StringOperand(org.refcodes.struct.Relation<String,String> aProperty)
      Instantiates a new {StringOperand Flag} with the alias being the proerty's key and the value being the property's value.
      Parameters:
      aProperty - The key (=alias) and the value for the operand.
    • StringOperand

      public StringOperand(org.refcodes.struct.Relation<String,String> aProperty, Consumer<StringOperand> aConsumer)
      Instantiates a new {StringOperand Flag} with the alias being the proerty's key and the value being the property's value.
      Parameters:
      aProperty - The key (=alias) and the value for the operand.
      aConsumer - The Consumer being invoked in case this StringOperand participated in successfully parsing the command line arguments.
    • StringOperand

      public StringOperand(String aAlias, String aDescription)
      Instantiates a new StringOperand.
      Parameters:
      aAlias - The alias to be used for naming purposes.
      aDescription - The description to be used (without any line breaks).
    • StringOperand

      public StringOperand(String aAlias, String aDescription, Consumer<StringOperand> aConsumer)
      Instantiates a new StringOperand.
      Parameters:
      aAlias - The alias to be used for naming purposes.
      aDescription - The description to be used (without any line breaks).
      aConsumer - The Consumer being invoked in case this StringOperand participated in successfully parsing the command line arguments.
  • Method Details

    • withVisible

      public StringOperand withVisible(boolean isVisible)
      Visibility in this context means displaying or hiding this Term's existence to the user (defaults to true).
    • toType

      protected String toType(String aArg)
      To value.
      Specified by:
      toType in class AbstractOperand<String>
      Parameters:
      aArg - the arg
      Returns:
      the string
    • 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.
    • setVisible

      public void setVisible(boolean isVisible)
      Visibility in this context means displaying or hiding this Term's existence to the user (defaults to true).
      Specified by:
      setVisible in interface Term
      Specified by:
      setVisible in interface org.refcodes.graphical.VisibleAccessor.VisibleMutator
    • isVisible

      public boolean isVisible()
      Visibility in this context means displaying or hiding this Term's existence to the user (defaults to true).
      Specified by:
      isVisible in interface Term
      Specified by:
      isVisible in interface org.refcodes.graphical.VisibleAccessor
    • 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.