Class ConfigSection
A named collection of somewhat ordered key/value pairs appearing as part of Config
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
getOneRequired
(String key) int
hashCode()
boolean
abstract Map<ConfigString,
List<ConfigString>> toMap()
Builds a multi-map view of all the key values, where repeated keys return a list of all the values for the key.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.
-
Constructor Details
-
ConfigSection
-
-
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) -
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, where repeated keys are ignored (last one wins)
-
toMultiMap
Builds a multi-map view of all the key values, where repeated keys return a list of all the values for the key. This is a version of toConfigMap where the
ConfigString
s are converted to strings for cases where the location metadata isn't wanted (or ConfigString isn't yet handled). -
toConfigMap
- Returns:
- a multi-map view of all the key values, where repeated keys return a list of all the values for the key
-
equals
-
hashCode
public int hashCode() -
getLocation
- Returns:
- the location that was the source of this configuration section
-
getName
-