All Superinterfaces:
IClusterable, Serializable
All Known Implementing Classes:
AbstractConfig, CombinableConfig, ConfigWithFallback, MutableConfig

public interface Config extends IClusterable
configuration interface
Author:
Michael Haitz
  • Method Summary

    Modifier and Type
    Method
    Description
    all()
     
    <T> boolean
    contains(IKey<T> key)
    returns true if given key is set to this config
    <T> T
    get(IKey<T> key)
    returns the value for the given key.
    boolean
     
    <T> Config
    put(IKey<T> key, T value)
    puts a new config to the configuration map.
    <T> T
    remove(IKey<T> key)
    removes the given key (and its value) from configuration map.
     
  • Method Details

    • toJsonString

      String toJsonString()
      Returns:
      json string representation of this config
    • all

      Map<String,Object> all()
      Returns:
      an immutable map of all key/values
    • isEmpty

      boolean isEmpty()
      Returns:
      true, if config map is empty or all keys uses their default value
    • put

      <T> Config put(IKey<T> key, T value)
      puts a new config to the configuration map. If given value is default value of key then it will be removed. This is necessary to keep the ui code small and clean. Also the given value type will be asserted by IKey implementation.
      Parameters:
      key - mandatory parameter
      value - mandatory parameter
      Returns:
      same instance for chaining
    • remove

      <T> T remove(IKey<T> key)
      removes the given key (and its value) from configuration map.
      Parameters:
      key - the key to remove
    • get

      <T> T get(IKey<T> key)
      returns the value for the given key. If no value is set, the default value will be returned.
      Parameters:
      key - The key to read.
      Returns:
      the value.
    • contains

      <T> boolean contains(IKey<T> key)
      returns true if given key is set to this config
      Parameters:
      key - The key to check.
      Returns:
      true if key exists.