public abstract class AbstractConfig
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ENV_VARIABLE_PREFIX |
static java.lang.String |
SYSTEM_PROPERTY_PREFIX |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getValueFromEnvironment(java.lang.String key)
Looks up a value by a key from java properties and the system environment.
|
static <T> java.util.Optional<T> |
getValueFromEnvironment(java.lang.String key, java.lang.Class<T> type) |
static java.lang.Object |
parseString(java.lang.String value, java.lang.Class type) |
void |
setSerializable(boolean serializable)
Set this config to be serializable
|
public static final java.lang.String ENV_VARIABLE_PREFIX
public static final java.lang.String SYSTEM_PROPERTY_PREFIX
public static java.lang.String getValueFromEnvironment(java.lang.String key)
key
first in the java system properties prefixed with SYSTEM_PROPERTY_PREFIX
and returns the value if present. If it is not present, looks it up in the system environment prefixed with ENV_VARIABLE_PREFIX
and returns this one if present. Returns null
if the key is neither found in the properties nor in the environment.key
- the key to look upnull
if the key is not availableSYSTEM_PROPERTY_PREFIX
, ENV_VARIABLE_PREFIX
, System.getProperty(String)
, System.getenv(String)
public static <T> java.util.Optional<T> getValueFromEnvironment(java.lang.String key, java.lang.Class<T> type)
public static java.lang.Object parseString(java.lang.String value, java.lang.Class type)
public void setSerializable(boolean serializable)
serializable
- true if serializable, false otherwiseCopyright © 2017 Oracle Corp. All Rights Reserved.