Class SystemPropertiesRepository

java.lang.Object
com.github.joschi.jadconfig.repositories.SystemPropertiesRepository
All Implemented Interfaces:
Repository

public class SystemPropertiesRepository extends Object implements Repository
Repository class providing access to System properties.

A prefix for all key lookups can be defined with SystemPropertiesRepository(String). The default prefix is empty.

Author:
jschalanda
See Also:
  • Constructor Details

    • SystemPropertiesRepository

      public SystemPropertiesRepository()
      Creates a new instance of SystemPropertiesRepository with the default settings, i. e. no prefix.
    • SystemPropertiesRepository

      public SystemPropertiesRepository(String prefix)
      Creates a new instance of SystemPropertiesRepository with the given prefix.
      Parameters:
      prefix - The prefix used for key lookups, e. g. "custom.".
  • Method Details

    • open

      public void open() throws RepositoryException
      Description copied from interface: Repository
      Opens the configuration repository, e. g. create a database connection, open a file on disk for reading
      Specified by:
      open in interface Repository
      Throws:
      RepositoryException - If an error occurred while opening the data source
    • read

      public String read(String name)
      Description copied from interface: Repository
      Reads the configuration parameter name from the backing data source. The name is specific to the underlying data source.
      Specified by:
      read in interface Repository
      Parameters:
      name - The parameter name
      Returns:
      The value of the provided name as String
    • close

      public void close() throws RepositoryException
      Description copied from interface: Repository
      Closes the underlying data source when it isn't require any more.
      Specified by:
      close in interface Repository
      Throws:
      RepositoryException - If an error occurred while closing the underlying data source
    • size

      public int size()