public class EnvironmentRepository extends Object implements Repository
Repository class providing access to environment variables.
All keys are being looked up in upper case unless deactivated with the appropriate
constructor (EnvironmentRepository(boolean).
A prefix for all key lookups can be defined with EnvironmentRepository(String).
The default prefix is empty.System.getenv(),
System.getenv(String)| Constructor and Description |
|---|
EnvironmentRepository()
Creates a new instance of
EnvironmentRepository with the default settings,
i. |
EnvironmentRepository(boolean upperCase)
Creates a new instance of
EnvironmentRepository with an empty prefix. |
EnvironmentRepository(String prefix)
Creates a new instance of
EnvironmentRepository with the given prefix. |
EnvironmentRepository(String prefix,
boolean upperCase)
Creates a new instance of
EnvironmentRepository with the given prefix. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying data source when it isn't require any more.
|
void |
open()
Opens the configuration repository, e.
|
String |
read(String name)
Reads the configuration parameter name from the backing data source.
|
int |
size() |
public EnvironmentRepository()
EnvironmentRepository with the default settings,
i. e. no prefix and keys looked up in upper case.public EnvironmentRepository(String prefix)
EnvironmentRepository with the given prefix.prefix - The prefix used for key lookups, e. g. "MY_APP_".public EnvironmentRepository(boolean upperCase)
EnvironmentRepository with an empty prefix.upperCase - Whether keys should be looked up in upper case.public EnvironmentRepository(String prefix, boolean upperCase)
EnvironmentRepository with the given prefix.prefix - The prefix used for key lookups, e. g. "MY_APP_".upperCase - Whether keys should be looked up in upper case.public void open()
throws RepositoryException
Repositoryopen in interface RepositoryRepositoryException - If an error occurred while opening the data sourcepublic String read(String name)
Repositoryread in interface Repositoryname - The parameter nameStringpublic void close()
throws RepositoryException
Repositoryclose in interface RepositoryRepositoryException - If an error occurred while closing the underlying data sourcepublic int size()
Copyright © 2022. All rights reserved.