Class Config


  • public class Config
    extends java.lang.Object
    Configuration information for a database.
    • Constructor Summary

      Constructors 
      Constructor Description
      Config()
      Construct a Config with the default values.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Config fromEnv​(java.lang.String name)
      Constructs a Config based upon the system environment.
      java.nio.file.Path getDataPath()
      Get the folder where data will be stored.
      java.lang.String getDbName()
      Get the name to use for the database.
      Config withDataPath​(java.lang.String first, java.lang.String... more)
      Construct a copy of this Config with the given data path.
      Config withDataPath​(java.nio.file.Path path)
      Construct a copy of this Config with the given data path.
      Config withDbName​(java.lang.String dbName)
      Construct a copy of this Config with the given db name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Config

        public Config()
        Construct a Config with the default values.
    • Method Detail

      • getDbName

        public java.lang.String getDbName()
        Get the name to use for the database.
        Returns:
        the database name
      • withDbName

        public Config withDbName​(java.lang.String dbName)
        Construct a copy of this Config with the given db name.
        Parameters:
        dbName - the db name
        Returns:
        the new Config
      • getDataPath

        public java.nio.file.Path getDataPath()
        Get the folder where data will be stored.
        Returns:
        folder where data will be stored
      • withDataPath

        public Config withDataPath​(java.lang.String first,
                                   java.lang.String... more)
        Construct a copy of this Config with the given data path.
        Parameters:
        first - the data path
        more - the rest of the data path to join to first
        Returns:
        the new Config
      • withDataPath

        public Config withDataPath​(java.nio.file.Path path)
        Construct a copy of this Config with the given data path.
        Parameters:
        path - the data path
        Returns:
        the new Config
      • fromEnv

        public static Config fromEnv​(java.lang.String name)
        Constructs a Config based upon the system environment. The uppercase name is used as a prefix for any environment variables.

        {name}_DB_PATH to set the data path.

        Parameters:
        name - the name for the db
        Returns:
        the new Config