Interface OptionSet
- All Known Subinterfaces:
OptionManager
- All Known Implementing Classes:
BaseOptionManager
,FallbackOptionManager
,FragmentOptionManager
,InMemoryOptionManager
,QueryOptionManager
,SessionOptionManager
,SystemOptionManager
public interface OptionSet
Immutable set of options accessible by name or validator.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getBoolean
(String name) Return the value of a Boolean option.getDefault
(String optionName) Gets the default value for the specified option.double
Return the value of a double option.int
Return the value of a long option as an intlong
Return the value of a long option.Gets the option value for the given option name.boolean
getOption
(TypeValidators.BooleanValidator validator) Gets the boolean value (from the option value) for the given boolean validator.double
getOption
(TypeValidators.DoubleValidator validator) Gets the double value (from the option value) for the given double validator.long
getOption
(TypeValidators.LongValidator validator) Gets the long value (from the option value) for the given long validator.getOption
(TypeValidators.StringValidator validator) Gets the string value (from the option value) for the given string validator.Return the value of a String option.
-
Method Details
-
getOption
Gets the option value for the given option name. This interface also provides convenient methods to get typed option values:getOption(TypeValidators.BooleanValidator validator)
,getOption(TypeValidators.DoubleValidator validator)
,getOption(TypeValidators.LongValidator validator)
, andgetOption(TypeValidators.StringValidator validator)
.- Parameters:
name
- option name- Returns:
- the option value, null if the option does not exist
-
getDefault
Gets the default value for the specified option.- Parameters:
optionName
- The option to retrieve the default value for.- Returns:
- The default value for the option.
-
getOption
Gets the boolean value (from the option value) for the given boolean validator.- Parameters:
validator
- the boolean validator- Returns:
- the boolean value
-
getOption
Gets the double value (from the option value) for the given double validator.- Parameters:
validator
- the double validator- Returns:
- the double value
-
getOption
Gets the long value (from the option value) for the given long validator.- Parameters:
validator
- the long validator- Returns:
- the long value
-
getOption
Gets the string value (from the option value) for the given string validator.- Parameters:
validator
- the string validator- Returns:
- the string value
-
getBoolean
Return the value of a Boolean option.- Parameters:
name
- option name- Returns:
- the Boolean value
- Throws:
IllegalArgumentException
- if the option is undefined or is not of the correct data type
-
getInt
Return the value of a long option as an int- Parameters:
name
- option name- Returns:
- the long value
- Throws:
IllegalArgumentException
- if the option is undefined or is not of the correct data type
-
getLong
Return the value of a long option.- Parameters:
name
- option name- Returns:
- the long value
- Throws:
IllegalArgumentException
- if the option is undefined or is not of the correct data type
-
getDouble
Return the value of a double option.- Parameters:
name
- option name- Returns:
- the double value
- Throws:
IllegalArgumentException
- if the option is undefined or is not of the correct data type
-
getString
Return the value of a String option.- Parameters:
name
- option name- Returns:
- the String value
- Throws:
IllegalArgumentException
- if the option is undefined or is not of the correct data type
-