Class Config

java.lang.Object
be.panako.util.Config

public class Config
extends java.lang.Object
Writes and read the configuration values to and from a properties file.
Author:
Joren Six
  • Constructor Summary

    Constructors
    Constructor Description
    Config()
    Hidden default constructor.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String get​(Key key)  
    static boolean getBoolean​(Key key)  
    static float getFloat​(Key key)  
    static Config getInstance()  
    static int getInt​(Key key)  
    static java.lang.String getPreference​(java.lang.String key)
    Use preferences to store configuration that changes during runtime and need to be persisted.
    java.lang.String readPreference​(java.lang.String preferenceKey)  
    static void set​(Key key, java.lang.String value)
    Sets a configuration value to use during the runtime of the application.
    static void setPreference​(java.lang.String key, java.lang.String value)
    Use preferences to store configuration that changes during runtime and need to be persisted.
    void writePreference​(java.lang.String preferenceKey, java.lang.String value)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Config

      public Config()
      Hidden default constructor. Reads the configured values, or stores the defaults.
  • Method Details

    • writePreference

      public void writePreference​(java.lang.String preferenceKey, java.lang.String value)
    • readPreference

      public java.lang.String readPreference​(java.lang.String preferenceKey)
    • getInstance

      public static Config getInstance()
    • get

      public static java.lang.String get​(Key key)
    • getInt

      public static int getInt​(Key key)
    • getFloat

      public static float getFloat​(Key key)
    • getBoolean

      public static boolean getBoolean​(Key key)
    • set

      public static void set​(Key key, java.lang.String value)
      Sets a configuration value to use during the runtime of the application. These configuration values are not persisted. To
      Parameters:
      key - The key to set.
      value - The value to use.
    • setPreference

      public static void setPreference​(java.lang.String key, java.lang.String value)
      Use preferences to store configuration that changes during runtime and need to be persisted.
      Parameters:
      key - The key to store.
      value - The value to store
    • getPreference

      public static java.lang.String getPreference​(java.lang.String key)
      Use preferences to store configuration that changes during runtime and need to be persisted.
      Parameters:
      key - The key to store.
      Returns:
      The configured preference value.