Module com.github.rvesse.airline
Class PartialRestriction
- java.lang.Object
-
- com.github.rvesse.airline.restrictions.AbstractCommonRestriction
-
- com.github.rvesse.airline.restrictions.common.PartialRestriction
-
- All Implemented Interfaces:
HelpHint
,ArgumentsRestriction
,OptionRestriction
public class PartialRestriction extends AbstractCommonRestriction implements HelpHint
-
-
Field Summary
Fields Modifier and Type Field Description private ArgumentsRestriction
argumentsRestriction
private HelpHint
hint
private java.util.Set<java.lang.Integer>
indices
private OptionRestriction
optionRestriction
-
Constructor Summary
Constructors Modifier Constructor Description PartialRestriction(int[] indices, ArgumentsRestriction argumentsRestriction)
PartialRestriction(int[] indices, OptionRestriction optionRestriction)
private
PartialRestriction(ArgumentsRestriction argumentsRestriction)
private
PartialRestriction(OptionRestriction optionRestriction)
PartialRestriction(java.util.Collection<java.lang.Integer> indices, ArgumentsRestriction argumentsRestriction)
PartialRestriction(java.util.Collection<java.lang.Integer> indices, OptionRestriction optionRestriction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.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 includedprivate <T> boolean
isApplicableToArgument(ParseState<T> state)
private <T> boolean
isApplicableToOption(ParseState<T> state, OptionMetadata option)
int
numContentBlocks()
Gets the number of content blocks provided<T> void
postValidate(ParseState<T> state, ArgumentsMetadata arguments, java.lang.Object value)
Method that is called after Airline has converted a string argument received into a strongly typed Java value<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, ArgumentsMetadata arguments, java.lang.String value)
Method that is called before Airline attempts to convert 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 value-
Methods inherited from class com.github.rvesse.airline.restrictions.AbstractCommonRestriction
finalValidate, finalValidate, getArgumentTitle, getArgumentTitle, getOptionTitle
-
-
-
-
Field Detail
-
indices
private final java.util.Set<java.lang.Integer> indices
-
optionRestriction
private final OptionRestriction optionRestriction
-
argumentsRestriction
private final ArgumentsRestriction argumentsRestriction
-
hint
private final HelpHint hint
-
-
Constructor Detail
-
PartialRestriction
private PartialRestriction(OptionRestriction optionRestriction)
-
PartialRestriction
private PartialRestriction(ArgumentsRestriction argumentsRestriction)
-
PartialRestriction
public PartialRestriction(int[] indices, OptionRestriction optionRestriction)
-
PartialRestriction
public PartialRestriction(int[] indices, ArgumentsRestriction argumentsRestriction)
-
PartialRestriction
public PartialRestriction(java.util.Collection<java.lang.Integer> indices, OptionRestriction optionRestriction)
-
PartialRestriction
public PartialRestriction(java.util.Collection<java.lang.Integer> indices, ArgumentsRestriction argumentsRestriction)
-
-
Method Detail
-
isApplicableToOption
private <T> boolean isApplicableToOption(ParseState<T> state, OptionMetadata option)
-
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
- Overrides:
preValidate
in classAbstractCommonRestriction
- 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
- Overrides:
postValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser stateoption
- Option meta-datavalue
- Strongly typed value
-
isApplicableToArgument
private <T> boolean isApplicableToArgument(ParseState<T> state)
-
preValidate
public <T> void preValidate(ParseState<T> state, ArgumentsMetadata arguments, java.lang.String value)
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
-
postValidate
public <T> void postValidate(ParseState<T> state, ArgumentsMetadata arguments, java.lang.Object value)
Description copied from interface:ArgumentsRestriction
Method that is called after Airline has converted a string argument received into a strongly typed Java value- Specified by:
postValidate
in interfaceArgumentsRestriction
- Overrides:
postValidate
in classAbstractCommonRestriction
- Parameters:
state
- Parser statearguments
- Arguments meta-datavalue
- Strongly typed value
-
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
-
-