-
- All Superinterfaces:
org.refcodes.component.Resetable,Synopsis,Syntaxable
- All Known Subinterfaces:
Condition
- All Known Implementing Classes:
AbstractCondition,AllCondition,AndCondition,AnyCondition,CasesCondition,OptionCondition,OrCondition,XorCondition
public interface ArgsSyntax extends Syntaxable
TheArgsSyntaxinterface represents a node (and therewith the syntax for the arguments) in the command line arguments syntax tree; simply extending theSyntaxableinterface and adding the functionality of providing access to the addedOperands (leafs). In future extensions, aArgsSyntaxmight provide access to the childSyntaxableelements contained in aArgsSyntaxinstance. As of the current findings, access to the children of theArgsSyntaxnode is not required and would make the interface unnecessarily complicated.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T extends Operand<?>>
TtoOperand(Class<T> aType)Traverses the hierarchy ofArgsSyntaxtree and returns the (first) operand matching the given type.default Operand<?>toOperand(String aAlias)Traverses the hierarchy ofArgsSyntaxtree and returns the (first) operand matching the given alias.<T extends Operand<?>>
TtoOperand(String aAlias, Class<T> aType)Traverses the hierarchy ofArgsSyntaxtree and returns the (first) operand matching the given alias and type.List<? extends Operand<?>>toOperands()Traverses the hierarchy ofArgsSyntaxs and collects all therein foundOperands and sub-types such as theFlagor theOption.-
Methods inherited from interface org.refcodes.cli.Synopsis
toSynopsis, toSynopsis, toSynopsis, toSynopsis
-
-
-
-
Method Detail
-
toOperands
List<? extends Operand<?>> toOperands()
Traverses the hierarchy ofArgsSyntaxs and collects all therein foundOperands and sub-types such as theFlagor theOption. This is most useful when creating a list ofOptions,Flages andOperands when printing out detailed help.- Returns:
- The according
Operandelements.
-
toOperand
default Operand<?> toOperand(String aAlias)
Traverses the hierarchy ofArgsSyntaxtree and returns the (first) operand matching the given alias.- Parameters:
aAlias- The alias for which to seek for.- Returns:
- The according
Operandelement or null if none matching was found.
-
toOperand
default <T extends Operand<?>> T toOperand(Class<T> aType)
Traverses the hierarchy ofArgsSyntaxtree 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
Operandelement or null if none matching was found
-
toOperand
<T extends Operand<?>> T toOperand(String aAlias, Class<T> aType)
Traverses the hierarchy ofArgsSyntaxtree 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
Operandelement or null if none matching was found
-
-