Interface VariableValueParameters.StaticChoicesBuilder<T>
- All Superinterfaces:
- AbstractBuilder<ValueParameter<T>>,- Builder<ValueParameter<T>,,- VariableValueParameters.StaticChoicesBuilder<T>> - ResettableBuilder<ValueParameter<T>,- VariableValueParameters.StaticChoicesBuilder<T>> 
- Enclosing class:
- VariableValueParameters
public static interface VariableValueParameters.StaticChoicesBuilder<T>
extends Builder<ValueParameter<T>,VariableValueParameters.StaticChoicesBuilder<T>> 
A builder that creates a 
ValueParameter that tries to match an
 argument against a fixed set of choices and returns an appropriate object
 based on the supplied argument.
 Note that the choices from such a parameter cannot be changed once
 this parameter has been built. Should a set of choices that change during
 the lifetime of the server be required, use the
 VariableValueParameters.DynamicChoicesBuilder instead.
- 
Method SummaryModifier and TypeMethodDescriptionAdds a choice to the parameter, along with the object that would be returned if the choice is selected.addChoices(Iterable<String> choices, Supplier<? extends T> returnedObjectSupplier) Adds a collection of choices to the parameter, along with aSupplierthat will return an object if one of the choices is selected.addChoices(Map<String, ? extends T> choices) Adds a collection of choices to the parameter, along with the objects that would be returned if the associated choice is selected.build()Tests for validity and creates thisValueParametershowInUsage(boolean showInUsage) Sets what should happen if the usage of this parameter is requested.
- 
Method Details- 
addChoiceAdds a choice to the parameter, along with the object that would be returned if the choice is selected.- Parameters:
- choice- The string to be matched
- returnedObject- The- to return
- Returns:
- This builder, for chaining
 
- 
addChoicesAdds a collection of choices to the parameter, along with the objects that would be returned if the associated choice is selected.- Parameters:
- choices- A- Mapcontaining the choices and associated objects.
- Returns:
- This builder, for chaining
 
- 
addChoicesVariableValueParameters.StaticChoicesBuilder<T> addChoices(Iterable<String> choices, Supplier<? extends T> returnedObjectSupplier) Adds a collection of choices to the parameter, along with aSupplierthat will return an object if one of the choices is selected.- Parameters:
- choices- The valid choices
- returnedObjectSupplier- Supplies the object to return
- Returns:
- This builder, for chaining
 
- 
showInUsageSets what should happen if the usage of this parameter is requested.If there are 5 or fewer choices available, and "showInUsage" is true, the choices will be shown in the command usage. Otherwise, the usage will only display only the key. - Parameters:
- showInUsage- true if the choices should be shown
- Returns:
- This builder, for chaining
 
- 
buildValueParameter<T> build()Tests for validity and creates thisValueParameter- Specified by:
- buildin interface- AbstractBuilder<T>
- Returns:
- The ValueParameter
- Throws:
- IllegalStateException- if no choices have been specified
 
 
-