Package nz.org.riskscape.config
Interface ConfigSection
public interface ConfigSection
A named collection of String key value pairs.
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
getOneRequired
(String key) default boolean
toMap()
Defeat Java's generics checking - it's safe to treat a list of strings as a list of wild things, but to do this with java's generics requires us to declare the receiver as? extends List<?>
which complicates the receiver a lot.
-
Method Details
-
wild
Defeat Java's generics checking - it's safe to treat a list of strings as a list of wild things, but to do this with java's generics requires us to declare the receiver as
? extends List<?>
which complicates the receiver a lot. I can't think of any cases where the use of this would cause a class cast exception, and it simplifies the use of APIs that accept a list of anything vs a list of strings (like binding) -
getLocation
URI getLocation()- Returns:
- the location that was the source of this configuration section
-
getName
String getName() -
hasKey
- Returns:
- true if this section contains at least one value for the given key
-
getOneRequired
- Returns:
- a value for the given key, or an error if it was missing or if there multiple values defined
-
getOne
- Returns:
- a value for the given key, or an error if multiple values were defined. Also wraps it in an optional (i know...) if the value is not defined.
-
getAll
- Returns:
- a list of all values defined for the given key, or an empty list if none are defined
-
toMap
- Returns:
- a map view of all the key value pairs
-
toMultiMap
- Returns:
- a multi-map view of all the key values, where repeated keys return a list of all the values for the key
-