Class Config

java.lang.Object
clazzfish.core.Config

public final class Config extends Object
All config stuff is encapsulated in this class.
Since:
2.3 (05.12.24)
Author:
oboehm
  • Field Details

    • DUMP_DIR

      public static final String DUMP_DIR
      Property name of the directory where the class statistic is dumped to.
      See Also:
    • DUMP_URI

      public static final String DUMP_URI
      Property name of URI where the class statistic is dumped to.
      See Also:
    • PATTERN_EXCLUDE

      public static final String PATTERN_EXCLUDE
      Pattern of the resources (and classes) which should be filtered out.
      See Also:
    • NULL_URI

      public static final URI NULL_URI
      NULL URI.
    • DEFAULT

      public static Config DEFAULT
  • Method Details

    • of

      public static Config of(String... resources)
    • of

      public static Config of(Properties props)
    • getEnvironment

      public static String getEnvironment(String key)
      Gets the system property for the given key. If it is not set as system property it tries to find it as environment variable (in uppercase and with underscores instead of dots).
      Parameters:
      key - name of the property or environment variable (in lowercase)
      Returns:
      found value or null
    • loadProperties

      public static Properties loadProperties(String resource) throws IOException
      Loads the properties from the classpath and provides them as system properties.
      Parameters:
      resource - the name of the classpath resource
      Returns:
      the loaded properties
      Throws:
      IOException - if properties can't be loaded
      See Also:
    • getClassLoader

      public static ClassLoader getClassLoader()
      Gets the class loader.
      Returns:
      a valid classloader
    • loadProperties

      public static Properties loadProperties(InputStream istream) throws IOException
      Loads the properties from the given InputStream and provides them as system properties.

      Note: Setting it as system property is not guaranteed to run in a cluster or cloud. E.g. on Google's App Engine this seems not to work.

      Parameters:
      istream - from here the properties are loaded
      Returns:
      the loaded properties
      Throws:
      IOException - if properties can't be loaded
    • getDumpDir

      public File getDumpDir()
      Get the directory where the collected dates and statistics are dumped to.
      Returns:
      directory for export
    • setDumpDir

      public void setDumpDir(File dir)
      Here you can set the directory where the collected dates and statistics should be dumped to.
      Parameters:
      dir - directory for export
    • getDumpURI

      public URI getDumpURI()
      Get the directory or URI where the collected dates and statistics are dumped to.
      Returns:
      directory or URI for export
    • setDumpURI

      public void setDumpURI(URI uri)
      Here you can set the directory or locaction where the collected dates and statistics should be dumped to.
      Parameters:
      uri - directory or URI for export
    • getProperties

      public Properties getProperties()
    • getProperty

      public String getProperty(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object