Class SystemPropertiesRepository
java.lang.Object
com.github.joschi.jadconfig.repositories.SystemPropertiesRepository
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionCreates a new instance ofSystemPropertiesRepositorywith the default settings, i. e. no prefix.SystemPropertiesRepository(String prefix) Creates a new instance ofSystemPropertiesRepositorywith the given prefix. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying data source when it isn't require any more.voidopen()Opens the configuration repository, e. g. create a database connection, open a file on disk for readingReads the configuration parameter name from the backing data source.intsize()
-
Constructor Details
-
SystemPropertiesRepository
public SystemPropertiesRepository()Creates a new instance ofSystemPropertiesRepositorywith the default settings, i. e. no prefix. -
SystemPropertiesRepository
Creates a new instance ofSystemPropertiesRepositorywith the given prefix.- Parameters:
prefix- The prefix used for key lookups, e. g."custom.".
-
-
Method Details
-
open
Description copied from interface:RepositoryOpens the configuration repository, e. g. create a database connection, open a file on disk for reading- Specified by:
openin interfaceRepository- Throws:
RepositoryException- If an error occurred while opening the data source
-
read
Description copied from interface:RepositoryReads the configuration parameter name from the backing data source. The name is specific to the underlying data source.- Specified by:
readin interfaceRepository- Parameters:
name- The parameter name- Returns:
- The value of the provided name as
String
-
close
Description copied from interface:RepositoryCloses the underlying data source when it isn't require any more.- Specified by:
closein interfaceRepository- Throws:
RepositoryException- If an error occurred while closing the underlying data source
-
size
public int size()
-