Interface ConfigSection


public interface ConfigSection

A named collection of String key value pairs.

  • Method Details

    • wild

      static Map<String,List<?>> wild(Map<String,List<String>> multiMap)

      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()
      Returns:
      a name that uniquely identifies this Config section among all others from the same Config object. This might have a prefix added for the type of thing this config identifies, e.g. "type flood_hazard"
    • hasKey

      default boolean hasKey(String key)
      Returns:
      true if this section contains at least one value for the given key
    • getOneRequired

      ResultOrProblems<String> getOneRequired(String key)
      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

      List<String> getAll(String key)
      Returns:
      a list of all values defined for the given key, or an empty list if none are defined
    • toMap

      Map<String,String> toMap()
      Returns:
      a map view of all the key value pairs
    • toMultiMap

      Map<String,List<String>> toMultiMap()
      Returns:
      a multi-map view of all the key values, where repeated keys return a list of all the values for the key