public class Config
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
<T> java.util.Optional<T> |
getOptionalValue(java.lang.String key,
java.lang.Class<T> valueType)
Retrieve a value from properties file.
|
<T> T |
getValue(java.lang.String key,
java.lang.Class<T> valueType)
Retrieve a value from properties file.
|
static Config |
main()
Retrieve a facade for the main config.
|
public static Config main()
public <T> T getValue(java.lang.String key, java.lang.Class<T> valueType)
key
- the name of the corresponding key which value to retrievevalueType
- the expected type of the value to be retrievedjava.lang.IllegalArgumentException
- if the given key does not existjava.lang.ClassCastException
- if the retrieved value cannot be cast to `valueType` typepublic <T> java.util.Optional<T> getOptionalValue(java.lang.String key, java.lang.Class<T> valueType)
key
- the name of the corresponding key which value to retrievevalueType
- the expected type of the value to be retrievedOptional.empty()
if the key is not presentjava.io.UncheckedIOException
- if the given properties file does not exist/not accessiblejava.lang.ClassCastException
- if the retrieved value cannot be cast to `valueType` type