Module com.github.rvesse.airline
Class AbstractStringRestriction
java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
com.github.rvesse.airline.restrictions.common.AbstractStringRestriction
- All Implemented Interfaces:
ArgumentsRestriction
,OptionRestriction
- Direct Known Subclasses:
AbstractLocaleAndCaseStringRestriction
,LengthRestriction
,NotBlankRestriction
,NotEmptyRestriction
Abstract restrictions on string values for options and arguments
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Method that derived classes must implement to check whether a value is validfinal <T> void
preValidate
(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 valuefinal <T> void
preValidate
(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 valueprotected abstract <T> ParseRestrictionViolatedException
violated
(ParseState<T> state, ArgumentsMetadata arguments, String value) Method that derived classes must implement to provide an exception for the case of an invalid argument value, this will be called ifisValid(String)
returnsfalse
protected abstract <T> ParseRestrictionViolatedException
violated
(ParseState<T> state, OptionMetadata option, String value) Method that derived classes must implement to provide an exception for the case of an invalid option value, this will be called ifisValid(String)
returnsfalse
Methods inherited from class com.github.rvesse.airline.restrictions.AbstractCommonRestriction
finalValidate, finalValidate, getArgumentTitle, getArgumentTitle, getOptionTitle, postValidate, postValidate
-
Constructor Details
-
AbstractStringRestriction
public AbstractStringRestriction()
-
-
Method Details
-
preValidate
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
- Overrides:
preValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser stateoption
- Option meta-datavalue
- String value
-
preValidate
Description copied from interface:ArgumentsRestriction
Method that is called before Airline attempts to convert a string argument received into a strongly typed Java value- Specified by:
preValidate
in interfaceArgumentsRestriction
- Overrides:
preValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser statearguments
- Arguments meta-datavalue
- String value
-
isValid
Method that derived classes must implement to check whether a value is valid- Parameters:
value
- Value- Returns:
- True if valid, false if valid
-
violated
protected abstract <T> ParseRestrictionViolatedException violated(ParseState<T> state, OptionMetadata option, String value) Method that derived classes must implement to provide an exception for the case of an invalid option value, this will be called ifisValid(String)
returnsfalse
- Parameters:
state
- Parser stateoption
- Option metadata for the option whose value is being checkedvalue
- Value which has been deemed invalid- Returns:
- Exception
-
violated
protected abstract <T> ParseRestrictionViolatedException violated(ParseState<T> state, ArgumentsMetadata arguments, String value) Method that derived classes must implement to provide an exception for the case of an invalid argument value, this will be called ifisValid(String)
returnsfalse
- Parameters:
state
- Parser statearguments
- Arguments metadatavalue
- Value which has been deemed invalid- Returns:
- Exception
-