Class PortRestriction
java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
com.github.rvesse.airline.restrictions.common.PortRestriction
- All Implemented Interfaces:
HelpHint, ArgumentsRestriction, OptionRestriction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final int -
Constructor Summary
Constructors -
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 includedprotected booleaninAnyAcceptableRange(int port) protected voidinvalidArgumentsPort(ArgumentsMetadata arguments, String title, Object value) protected voidinvalidOptionPort(OptionMetadata option, String title, Object value) protected voidinvalidPort(String title, Object value) private booleanisValid(int port) private booleanisValid(long port) private booleanisValid(short port) intGets the number of content blocks provided<T> voidpostValidate(ParseState<T> state, ArgumentsMetadata arguments, Object value) Method that is called after Airline has converted a string argument received into a strongly typed Java value<T> voidpostValidate(ParseState<T> state, OptionMetadata option, Object value) Method that is called after Airline has converted a string argument received into a strongly typed Java valueMethods inherited from class AbstractCommonRestriction
finalValidate, finalValidate, getArgumentTitle, getArgumentTitle, getOptionTitle, preValidate, preValidate
-
Field Details
-
MIN_PORT
private static final int MIN_PORT- See Also:
-
MAX_PORT
private static final int MAX_PORT- See Also:
-
acceptablePorts
-
-
Constructor Details
-
PortRestriction
-
-
Method Details
-
postValidate
Description copied from interface:OptionRestrictionMethod that is called after Airline has converted a string argument received into a strongly typed Java value- Specified by:
postValidatein interfaceOptionRestriction- Overrides:
postValidatein classAbstractCommonRestriction- Parameters:
state- Parser stateoption- Option meta-datavalue- Strongly typed value
-
invalidOptionPort
-
invalidArgumentsPort
-
invalidPort
-
postValidate
Description copied from interface:ArgumentsRestrictionMethod that is called after Airline has converted a string argument received into a strongly typed Java value- Specified by:
postValidatein interfaceArgumentsRestriction- Overrides:
postValidatein classAbstractCommonRestriction- Parameters:
state- Parser statearguments- Arguments meta-datavalue- Strongly typed value
-
isValid
private boolean isValid(long port) -
isValid
private boolean isValid(int port) -
isValid
private boolean isValid(short port) -
inAnyAcceptableRange
protected boolean inAnyAcceptableRange(int port) -
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
-