Module com.github.rvesse.airline
Class MutuallyExclusiveRestriction
- java.lang.Object
-
- com.github.rvesse.airline.restrictions.options.MutuallyExclusiveRestriction
-
- All Implemented Interfaces:
HelpHint
,OptionRestriction
public class MutuallyExclusiveRestriction extends java.lang.Object implements OptionRestriction, HelpHint
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
tag
-
Constructor Summary
Constructors Constructor Description MutuallyExclusiveRestriction(java.lang.String tag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
finalValidate(ParseState<T> state, OptionMetadata option)
Method that is called after Airline has completed parsingjava.lang.String[]
getContentBlock(int blockNumber)
Gets the content block with the given numberHelpFormat
getFormat()
Gets the format of the provided help informationjava.lang.String
getPreamble()
Gets the preamble text that should be includedjava.lang.String
getTag()
private <T> java.util.Collection<OptionMetadata>
getTaggedOptions(ParseState<T> state)
int
numContentBlocks()
Gets the number of content blocks provided<T> void
postValidate(ParseState<T> state, OptionMetadata option, java.lang.Object value)
Method that is called after Airline has converted a string argument received into a strongly typed Java value<T> void
preValidate(ParseState<T> state, OptionMetadata option, java.lang.String value)
Method that is called before Airline attempts to convert a string argument received into a strongly typed Java valueprivate static java.lang.String
toOptionsList(java.lang.Iterable<OptionMetadata> options)
-
-
-
Method Detail
-
finalValidate
public <T> void finalValidate(ParseState<T> state, OptionMetadata option)
Description copied from interface:OptionRestriction
Method that is called after Airline has completed parsingThis can be used to implement restrictions that require the final parser state to process
- Specified by:
finalValidate
in interfaceOptionRestriction
- Parameters:
state
- Parser stateoption
- Option meta-data
-
toOptionsList
private static java.lang.String toOptionsList(java.lang.Iterable<OptionMetadata> options)
-
getTaggedOptions
private <T> java.util.Collection<OptionMetadata> getTaggedOptions(ParseState<T> state)
-
getTag
public java.lang.String getTag()
-
getPreamble
public java.lang.String getPreamble()
Description copied from interface:HelpHint
Gets the preamble text that should be included- Specified by:
getPreamble
in interfaceHelpHint
- Returns:
- Preamble text
-
getFormat
public HelpFormat getFormat()
Description copied from interface:HelpHint
Gets the format of the provided help information
-
numContentBlocks
public int numContentBlocks()
Description copied from interface:HelpHint
Gets the number of content blocks providedHelp generators should consult the
HelpHint.getFormat()
return value to determine how to format the content blocks but they are not required to do so- Specified by:
numContentBlocks
in interfaceHelpHint
- Returns:
- Number of content blocks
-
getContentBlock
public java.lang.String[] getContentBlock(int blockNumber)
Description copied from interface:HelpHint
Gets the content block with the given number- Specified by:
getContentBlock
in interfaceHelpHint
- Parameters:
blockNumber
- Block number- Returns:
- Content Block
-
preValidate
public <T> void preValidate(ParseState<T> state, OptionMetadata option, java.lang.String value)
Description copied from interface:OptionRestriction
Method that is called before Airline attempts to convert a string argument received into a strongly typed Java value- Specified by:
preValidate
in interfaceOptionRestriction
- Parameters:
state
- Parser stateoption
- Option meta-datavalue
- String value
-
postValidate
public <T> void postValidate(ParseState<T> state, OptionMetadata option, java.lang.Object value)
Description copied from interface:OptionRestriction
Method that is called after Airline has converted a string argument received into a strongly typed Java value- Specified by:
postValidate
in interfaceOptionRestriction
- Parameters:
state
- Parser stateoption
- Option meta-datavalue
- Strongly typed value
-
-