Class PatternRestriction
java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
com.github.rvesse.airline.restrictions.common.PatternRestriction
- All Implemented Interfaces:
HelpHint, ArgumentsRestriction, OptionRestriction
A restriction which requires the raw values to match a given regular
expression
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPatternRestriction(String pattern, int flags, String description) Creates a pattern restriction -
Method Summary
Modifier and TypeMethodDescriptionString[]getContentBlock(int blockNumber) Gets the content block with the given numberGets the format of the provided help informationGets the preamble text that should be includedintGets the number of content blocks provided<T> voidpreValidate(ParseState<T> state, ArgumentsMetadata arguments, String value) Method that is called before Airline attempts to convert a string argument received into a strongly typed Java value<T> voidpreValidate(ParseState<T> state, OptionMetadata option, String value) Method that is called before Airline attempts to convert a string argument received into a strongly typed Java valueMethods inherited from class AbstractCommonRestriction
finalValidate, finalValidate, getArgumentTitle, getArgumentTitle, getOptionTitle, postValidate, postValidate
-
Field Details
-
pattern
-
description
-
-
Constructor Details
-
PatternRestriction
Creates a pattern restriction- Parameters:
pattern- Regular expression patternflags- Regular expression flagsdescription- Friendly description of the intent of the pattern, included in errors when the restriction is violated
-
-
Method Details
-
preValidate
Description copied from interface:OptionRestrictionMethod that is called before Airline attempts to convert a string argument received into a strongly typed Java value- Specified by:
preValidatein interfaceOptionRestriction- Overrides:
preValidatein classAbstractCommonRestriction- Parameters:
state- Parser stateoption- Option meta-datavalue- String value
-
preValidate
Description copied from interface:ArgumentsRestrictionMethod that is called before Airline attempts to convert a string argument received into a strongly typed Java value- Specified by:
preValidatein interfaceArgumentsRestriction- Overrides:
preValidatein classAbstractCommonRestriction- Parameters:
state- Parser statearguments- Arguments meta-datavalue- String value
-
getPreamble
Description copied from interface:HelpHintGets the preamble text that should be included- Specified by:
getPreamblein interfaceHelpHint- Returns:
- Preamble text
-
getFormat
Description copied from interface:HelpHintGets the format of the provided help information -
numContentBlocks
public int numContentBlocks()Description copied from interface:HelpHintGets 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:
numContentBlocksin interfaceHelpHint- Returns:
- Number of content blocks
-
getContentBlock
Description copied from interface:HelpHintGets the content block with the given number- Specified by:
getContentBlockin interfaceHelpHint- Parameters:
blockNumber- Block number- Returns:
- Content Block
-