Package dk.mada.jaxrs.model.options
Class OptionReader
java.lang.Object
dk.mada.jaxrs.model.options.OptionReader
Configuration manipulation helpers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Read boolean property, defaulting to false if missing.boolean
Read boolean property, with default value if missing.Read optional option value.getDefault
(String name, String defaultValue) Read optional option with default value.getListDefault
(String name, String defaultValue) Read comma-separated list option with default value.getOptDefault
(String name, String defaultValue) Read optional option with default value.getRequired
(String name, String compatibleOptionName) Read required option.
-
Constructor Details
-
OptionReader
Constructs a new instance.- Parameters:
options
- user's options
-
-
Method Details
-
bool
Read boolean property, defaulting to false if missing.- Parameters:
name
- the name of the option.- Returns:
- boolean-value of the option
-
bool
Read boolean property, with default value if missing.- Parameters:
name
- the name of the option.defaultValue
- the default value if the option is not specified- Returns:
- boolean-value of the option
-
getRequired
Read required option.- Parameters:
name
- the name of the option.compatibleOptionName
- fall-back name if primary name not found- Returns:
- the property value
- Throws:
IllegalArgumentException
- if the property is missin
-
getOptDefault
Read optional option with default value.- Parameters:
name
- the option namedefaultValue
- the default value, if the option is not present- Returns:
- the property value
-
getListDefault
Read comma-separated list option with default value.- Parameters:
name
- the option namedefaultValue
- the default value, if the option is not present- Returns:
- the property value
-
getDefault
Read optional option with default value.- Parameters:
name
- the option namedefaultValue
- the default value, if the option is not present- Returns:
- the property value
-
get
Read optional option value.- Parameters:
name
- the option name- Returns:
- the trimmed property value if present
-