Class RequiredUnlessEnvironmentRestriction
java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
com.github.rvesse.airline.restrictions.options.AbstractRequiredUnlessRestriction
com.github.rvesse.airline.restrictions.options.RequiredUnlessEnvironmentRestriction
- All Implemented Interfaces:
HelpHint, ArgumentsRestriction, OptionRestriction
public class RequiredUnlessEnvironmentRestriction
extends AbstractRequiredUnlessRestriction
implements HelpHint
A restriction that requires an option/argument be set UNLESS a suitable environment variable is
specified.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
Fields -
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 includedintGets the number of content blocks providedprotected <T> booleanunless(ParseState<T> state, ArgumentsMetadata arguments) Answers whether the unless condition of the restriction is metprotected <T> booleanunless(ParseState<T> state, OptionMetadata option) Answers whether the unless condition of the restriction is metprotected StringProvides a description of the unless condition, this will be included in the error messages when this restriction is not metMethods inherited from class AbstractRequiredUnlessRestriction
finalValidate, finalValidateMethods inherited from class AbstractCommonRestriction
getArgumentTitle, getArgumentTitle, getOptionTitle, postValidate, postValidate, preValidate, preValidate
-
Field Details
-
variables
-
-
Constructor Details
-
RequiredUnlessEnvironmentRestriction
-
-
Method Details
-
unless
Description copied from class:AbstractRequiredUnlessRestrictionAnswers whether the unless condition of the restriction is metIf the unless condition is met then the restriction will not require the option to be present.
- Specified by:
unlessin classAbstractRequiredUnlessRestriction- Type Parameters:
T- Command Type- Parameters:
state- Parse stateoption- Option Metadata- Returns:
- True if unless condition met, false otherwise
-
unless
Description copied from class:AbstractRequiredUnlessRestrictionAnswers whether the unless condition of the restriction is metIf the unless condition is met then the restriction will not require arguments to be present.
- Specified by:
unlessin classAbstractRequiredUnlessRestriction- Type Parameters:
T- Command Type- Parameters:
state- Parse statearguments- Arguments Metadata- Returns:
- True if unless condition met, false otherwise
-
unlessDescription
Description copied from class:AbstractRequiredUnlessRestrictionProvides a description of the unless condition, this will be included in the error messages when this restriction is not met- Specified by:
unlessDescriptionin classAbstractRequiredUnlessRestriction- Returns:
- Unless condition description
-
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
-