Interface Directive<T>
- Type Parameters:
T- The generic type of theDirective's value.
- All Superinterfaces:
org.refcodes.mixin.AliasAccessor,org.refcodes.mixin.Clonable,Cloneable,Comparable<Operand<?>>,org.refcodes.mixin.DescriptionAccessor,org.refcodes.exception.ExceptionAccessor<ArgsSyntaxException>,MatchCountAccessor,Operand<T>,OperationAccessor,ParsedArgsAccessor,org.refcodes.mixin.Resetable,org.refcodes.schema.Schemable,Synopsisable,Term,org.refcodes.mixin.TypeAccessor<T>,org.refcodes.mixin.ValueAccessor<T>,org.refcodes.graphical.VisibleAccessor,org.refcodes.graphical.VisibleAccessor.VisibleBuilder<Term>,org.refcodes.graphical.VisibleAccessor.VisibleMutator,org.refcodes.graphical.VisibleAccessor.VisibleProperty
- All Known Implementing Classes:
AbstractDirective,ArrayDirective,BooleanDirective,CharDirective,DoubleDirective,EnumDirective,FileDirective,FloatDirective,IntDirective,LongDirective,StringDirective
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor
org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasPropertyNested 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.DescriptionPropertyNested classes/interfaces inherited from interface org.refcodes.exception.ExceptionAccessor
org.refcodes.exception.ExceptionAccessor.ExceptionBuilder<EXC extends Throwable,B extends org.refcodes.exception.ExceptionAccessor.ExceptionBuilder<EXC, B>>, org.refcodes.exception.ExceptionAccessor.ExceptionMutator<EXC extends Throwable>, org.refcodes.exception.ExceptionAccessor.ExceptionProperty<EXC extends Throwable> Nested classes/interfaces inherited from interface org.refcodes.cli.MatchCountAccessor
MatchCountAccessor.MatchCountBuilder<B extends MatchCountAccessor.MatchCountBuilder<B>>, MatchCountAccessor.MatchCountMutator, MatchCountAccessor.MatchCountPropertyNested classes/interfaces inherited from interface org.refcodes.cli.OperationAccessor
OperationAccessor.OperationBuilder<B extends OperationAccessor.OperationBuilder<B>>, OperationAccessor.OperationMutator, OperationAccessor.OperationPropertyNested classes/interfaces inherited from interface org.refcodes.cli.ParsedArgsAccessor
ParsedArgsAccessor.ParsedArgsMutator, ParsedArgsAccessor.ParsedArgsPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor
org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T, B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T> Nested classes/interfaces inherited from interface org.refcodes.mixin.ValueAccessor
org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V, B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V>, org.refcodes.mixin.ValueAccessor.ValueProperty<V> Nested classes/interfaces inherited from interface org.refcodes.graphical.VisibleAccessor
org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B extends org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B>>, org.refcodes.graphical.VisibleAccessor.VisibleMutator, org.refcodes.graphical.VisibleAccessor.VisibleProperty -
Method Summary
Modifier and TypeMethodDescriptionReturns the operation assigned to theDirectiveinstance.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.default StringtoSpec(CliContext aCliCtx) Creates a specification including its arguments.default StringtoSyntax(CliContext aCliCtx) Creates a syntax including its arguments.default StringtoUsage(CliContext aCliCtx) Creates a plain usage specification without any escape codes, helpful e.g. in human readable messages.Methods inherited from interface org.refcodes.mixin.Clonable
cloneMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.refcodes.mixin.DescriptionAccessor
getDescriptionMethods inherited from interface org.refcodes.cli.Operand
getAlias, getParsedArgs, getValue, hasValue, toSpec, toSpec, toSpec, toSpec, toUsage, toValueMethods inherited from interface org.refcodes.mixin.Resetable
resetMethods inherited from interface org.refcodes.schema.Schemable
toSchemaMethods inherited from interface org.refcodes.cli.Synopsisable
toSynopsis, toSynopsis, toSynopsis, toSynopsisMethods inherited from interface org.refcodes.cli.Term
argsParser, getException, getMatchCount, isVisible, parseArgs, parseArgs, setVisible, toSchema, toSynopsis, toSyntax, toSyntax, toSyntax, toSyntaxMethods inherited from interface org.refcodes.mixin.TypeAccessor
getTypeMethods inherited from interface org.refcodes.mixin.ValueAccessor
getValueOrMethods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleBuilder
withHide, withShow, withVisibleMethods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleMutator
hide, showMethods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleProperty
letVisible
-
Method Details
-
getOperation
String getOperation()Returns the operation assigned to theDirectiveinstance.- Specified by:
getOperationin interfaceOperationAccessor- Returns:
- The operation's
String.
-
toKeywords
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:
toKeywordsin interfaceOperand<T>- Parameters:
aCliCtx- TheCliContextto use when assembling the keywords.- Returns:
- The keywords with the according prefix.
-
toUsage
Creates a plain usage specification without any escape codes, helpful e.g. in human readable messages.- Specified by:
toUsagein interfaceOperand<T>- Parameters:
aCliCtx- TheCliContextto use when creating a beautiful usage text.- Returns:
- The according usage text.
-
toSpec
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:
toSpecin interfaceOperand<T>- Parameters:
aCliCtx- TheCliContextto use when creating a beautiful specification text.- Returns:
- The according specification text.
-
toSyntax
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.
-