public final class BasicEnvironmentService extends Object implements EnvironmentService
By default, an exception is thrown if a value cannot be located (unless a default value has been supplied).
By default, an exception is thrown if any placeholders cannot be resolved in any string values.
By default, string values are resolved before being returned
By default, environment variables are automatically checked if a normal property value cannot be found.
For example, given the key db.vendor
the service will also automatically check env.DB_VENDOR
Constructor and Description |
---|
BasicEnvironmentService()
Uses system properties / environment variables to resolve values
|
BasicEnvironmentService(EnvironmentServiceContext context)
Uses
context to resolve values |
BasicEnvironmentService(Properties properties)
Uses
properties to resolve values |
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(String key) |
Boolean |
getBoolean(String key) |
Boolean |
getBoolean(String key,
Boolean defaultValue) |
<T> Class<T> |
getClass(String key,
Class<T> type) |
<T> Class<T> |
getClass(String key,
Class<T> type,
Class<T> defaultValue) |
EnvironmentServiceContext |
getContext() |
File |
getFile(String key) |
File |
getFile(String key,
File defaultValue) |
Integer |
getInteger(String key) |
Integer |
getInteger(String key,
Integer defaultValue) |
protected String |
getMissingPropertyMessage(String key) |
<T> T |
getProperty(EnvContext<T> context) |
<T> T |
getProperty(String key,
Class<T> type) |
<T> T |
getProperty(String key,
Class<T> type,
T provided) |
protected <T> T |
getSpringValue(String key,
Class<T> type) |
protected <T> Class<T> |
getSpringValueAsClass(String key,
Class<T> type) |
String |
getString(String key) |
String |
getString(String key,
String defaultValue) |
public BasicEnvironmentService()
public BasicEnvironmentService(Properties properties)
properties
to resolve valuespublic BasicEnvironmentService(EnvironmentServiceContext context)
context
to resolve valuespublic boolean containsProperty(String key)
containsProperty
in interface EnvironmentService
public <T> T getProperty(EnvContext<T> context)
getProperty
in interface EnvironmentService
public <T> T getProperty(String key, Class<T> type, T provided)
getProperty
in interface EnvironmentService
public <T> T getProperty(String key, Class<T> type)
getProperty
in interface EnvironmentService
protected String getMissingPropertyMessage(String key)
protected <T> T getSpringValue(String key, Class<T> type)
protected <T> Class<T> getSpringValueAsClass(String key, Class<T> type)
public <T> Class<T> getClass(String key, Class<T> type)
getClass
in interface EnvironmentService
public <T> Class<T> getClass(String key, Class<T> type, Class<T> defaultValue)
getClass
in interface EnvironmentService
public String getString(String key)
getString
in interface EnvironmentService
public String getString(String key, String defaultValue)
getString
in interface EnvironmentService
public Boolean getBoolean(String key)
getBoolean
in interface EnvironmentService
public Boolean getBoolean(String key, Boolean defaultValue)
getBoolean
in interface EnvironmentService
public File getFile(String key)
getFile
in interface EnvironmentService
public File getFile(String key, File defaultValue)
getFile
in interface EnvironmentService
public Integer getInteger(String key, Integer defaultValue)
getInteger
in interface EnvironmentService
public Integer getInteger(String key)
getInteger
in interface EnvironmentService
public EnvironmentServiceContext getContext()
Copyright © 2010–2014 The Kuali Foundation. All rights reserved.