Module com.github.rvesse.airline
Class OccurrencesRestriction
- java.lang.Object
-
- com.github.rvesse.airline.restrictions.AbstractCommonRestriction
-
- com.github.rvesse.airline.restrictions.common.OccurrencesRestriction
-
- All Implemented Interfaces:
HelpHint
,ArgumentsRestriction
,OptionRestriction
public class OccurrencesRestriction extends AbstractCommonRestriction implements HelpHint
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
maximum
private int
occurrences
-
Constructor Summary
Constructors Constructor Description OccurrencesRestriction(int occurrences, boolean maximum)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
finalValidate(ParseState<T> state, ArgumentsMetadata arguments)
Method that is called after Airline has completed parsing<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 includedint
numContentBlocks()
Gets the number of content blocks providedprivate <T> java.util.List<java.lang.String>
titles(ParseState<T> state, ArgumentsMetadata arguments)
-
Methods inherited from class com.github.rvesse.airline.restrictions.AbstractCommonRestriction
getArgumentTitle, getArgumentTitle, getOptionTitle, postValidate, postValidate, preValidate, preValidate
-
-
-
-
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
- Overrides:
finalValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser stateoption
- Option meta-data
-
finalValidate
public <T> void finalValidate(ParseState<T> state, ArgumentsMetadata arguments)
Description copied from interface:ArgumentsRestriction
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 interfaceArgumentsRestriction
- Overrides:
finalValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser statearguments
- Arguments meta-data
-
titles
private <T> java.util.List<java.lang.String> titles(ParseState<T> state, ArgumentsMetadata arguments)
-
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
-
-