Module com.github.rvesse.airline
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 includedint
Gets the number of content blocks providedprotected <T> boolean
unless
(ParseState<T> state, ArgumentsMetadata arguments) Answers whether the unless condition of the restriction is metprotected <T> boolean
unless
(ParseState<T> state, OptionMetadata option) Answers whether the unless condition of the restriction is metprotected String
Provides a description of the unless condition, this will be included in the error messages when this restriction is not metMethods inherited from class com.github.rvesse.airline.restrictions.options.AbstractRequiredUnlessRestriction
finalValidate, finalValidate
Methods inherited from class com.github.rvesse.airline.restrictions.AbstractCommonRestriction
getArgumentTitle, getArgumentTitle, getOptionTitle, postValidate, postValidate, preValidate, preValidate
-
Field Details
-
variables
-
-
Constructor Details
-
RequiredUnlessEnvironmentRestriction
-
-
Method Details
-
unless
Description copied from class:AbstractRequiredUnlessRestriction
Answers 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:
unless
in 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:AbstractRequiredUnlessRestriction
Answers 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:
unless
in 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:AbstractRequiredUnlessRestriction
Provides a description of the unless condition, this will be included in the error messages when this restriction is not met- Specified by:
unlessDescription
in classAbstractRequiredUnlessRestriction
- Returns:
- Unless condition description
-
getPreamble
Description copied from interface:HelpHint
Gets the preamble text that should be included- Specified by:
getPreamble
in interfaceHelpHint
- Returns:
- Preamble text
-
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
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
-