Interface Condition

All Superinterfaces:
Constituent, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, Synopsisable
All Known Implementing Classes:
AbstractCondition, AllCondition, AndCondition, AnyCondition, CasesCondition, OrCondition, XorCondition

public interface Condition extends Constituent
The Condition interface represents a node (and therewith the syntax for the arguments) in the command line arguments syntax tree; simply extending the Constituent interface and adding the functionality of providing access to the added Operands (leafs). In future extensions, a Condition might provide access to the child Constituent elements contained in a Condition instance. As of the current findings, access to the children of the Condition node is not required and would make the interface unnecessarily complicated.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.mixin.DescriptionAccessor

    org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T extends Operand<?>>
    T
    toOperand(Class<T> aType)
    Traverses the hierarchy of Condition tree and returns the (first) operand matching the given type.
    default Operand<?>
    toOperand(String aAlias)
    Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias.
    <T extends Operand<?>>
    T
    toOperand(String aAlias, Class<T> aType)
    Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias and type.
    List<? extends Operand<?>>
    Traverses the hierarchy of Conditions and collects all therein found Operands and sub-types such as the Flag or the Option.

    Methods inherited from interface org.refcodes.cli.Constituent

    parseArgs, parseArgs, toSchema, toSynopsis, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax, toValue

    Methods inherited from interface org.refcodes.mixin.DescriptionAccessor

    getDescription

    Methods inherited from interface org.refcodes.mixin.Resetable

    reset

    Methods inherited from interface org.refcodes.cli.Synopsisable

    toSynopsis, toSynopsis, toSynopsis, toSynopsis
  • Method Details

    • toOperands

      List<? extends Operand<?>> toOperands()
      Traverses the hierarchy of Conditions and collects all therein found Operands and sub-types such as the Flag or the Option. This is most useful when creating a list of Options, Flages and Operands when printing out detailed help.
      Returns:
      The according Operand elements.
    • toOperand

      default Operand<?> toOperand(String aAlias)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias.
      Parameters:
      aAlias - The alias for which to seek for.
      Returns:
      The according Operand element or null if none matching was found.
    • toOperand

      default <T extends Operand<?>> T toOperand(Class<T> aType)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given type.
      Type Parameters:
      T - the generic type
      Parameters:
      aType - The type for which to seek for.
      Returns:
      The according Operand element or null if none matching was found
    • toOperand

      <T extends Operand<?>> T toOperand(String aAlias, Class<T> aType)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias and type.
      Type Parameters:
      T - the generic type
      Parameters:
      aAlias - The alias for which to seek for.
      aType - The type for which to seek for.
      Returns:
      The according Operand element or null if none matching was found