public class ConfigurationDecorator extends Object implements Configuration
Modifier and Type | Field and Description |
---|---|
protected Configuration |
delegate |
Constructor and Description |
---|
ConfigurationDecorator(Configuration delegate) |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
asFlatMap() |
Properties |
asProperties() |
ResourceBundle |
asResourceBundle() |
boolean |
containsKey(String key)
Searches for the key in this configuration.
|
protected <T> T |
convertValue(Object value,
Class<T> type) |
Object |
get(String key)
Returns the value associated with the given key.
|
<T> T |
get(String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getAs(String key)
/**
Finds a value associated with the given key.
|
<T> T |
getAs(String key,
T defaultValue)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(String key)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(String key,
boolean defaultValue)
Finds a value associated with the given key.
|
double |
getAsDouble(String key)
Finds a value associated with the given key.
|
double |
getAsDouble(String key,
double defaultValue)
Finds a value associated with the given key.
|
float |
getAsFloat(String key)
Finds a value associated with the given key.
|
float |
getAsFloat(String key,
float defaultValue)
Finds a value associated with the given key.
|
int |
getAsInt(String key)
Finds a value associated with the given key.
|
int |
getAsInt(String key,
int defaultValue)
Finds a value associated with the given key.
|
long |
getAsLong(String key)
Finds a value associated with the given key.
|
long |
getAsLong(String key,
long defaultValue)
Finds a value associated with the given key.
|
String |
getAsString(String key)
Finds a value associated with the given key.
|
String |
getAsString(String key,
String defaultValue)
Finds a value associated with the given key.
|
Object |
getAt(String key)
Returns the value associated with the given key.
|
<T> T |
getAt(String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type)
Finds a value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type,
T defaultValue)
Finds a value associated with the given key.
|
protected final Configuration delegate
public ConfigurationDecorator(@Nonnull Configuration delegate)
@Nullable public Object get(@Nonnull String key)
Configuration
get
in interface Configuration
key
- the key to search@Nullable public <T> T get(@Nonnull String key, @Nullable T defaultValue)
Configuration
get
in interface Configuration
T
- the type of the valuekey
- the key to searchdefaultValue
- the value to be returned if the key was not found@Nullable public Object getAt(@Nonnull String key)
Configuration
getAt
in interface Configuration
key
- the key to search@Nullable public <T> T getAt(@Nonnull String key, @Nullable T defaultValue)
Configuration
getAt
in interface Configuration
T
- the type of the valuekey
- the key to searchdefaultValue
- the value to be returned if the key was not foundpublic boolean getAsBoolean(@Nonnull String key)
Configuration
getAsBoolean
in interface Configuration
key
- the key to searchpublic boolean getAsBoolean(@Nonnull String key, boolean defaultValue)
Configuration
getAsBoolean
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not foundpublic int getAsInt(@Nonnull String key)
Configuration
getAsInt
in interface Configuration
key
- the key to searchpublic int getAsInt(@Nonnull String key, int defaultValue)
Configuration
getAsInt
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not foundpublic long getAsLong(@Nonnull String key)
Configuration
getAsLong
in interface Configuration
key
- the key to searchpublic long getAsLong(@Nonnull String key, long defaultValue)
Configuration
getAsLong
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not foundpublic float getAsFloat(@Nonnull String key)
Configuration
getAsFloat
in interface Configuration
key
- the key to searchpublic float getAsFloat(@Nonnull String key, float defaultValue)
Configuration
getAsFloat
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not foundpublic double getAsDouble(@Nonnull String key)
Configuration
getAsDouble
in interface Configuration
key
- the key to searchpublic double getAsDouble(@Nonnull String key, double defaultValue)
Configuration
getAsDouble
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not found@Nullable public String getAsString(@Nonnull String key)
Configuration
getAsString
in interface Configuration
key
- the key to search@Nullable public String getAsString(@Nonnull String key, @Nullable String defaultValue)
Configuration
getAsString
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not found@Nullable public <T> T getAs(@Nonnull String key)
Configuration
getAs
in interface Configuration
key
- the key to search@Nullable public <T> T getAs(@Nonnull String key, @Nullable T defaultValue)
Configuration
getAs
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not found@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type)
Configuration
PropertyEditor
.getConverted
in interface Configuration
key
- the key to searchtype
- the type to be returned@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type, @Nullable T defaultValue)
Configuration
PropertyEditor
.
If not found then the supplied defaultValue will be returned.getConverted
in interface Configuration
key
- the key to searchtype
- the type to be returneddefaultValue
- the value to be returned if the key is not found@Nonnull public Properties asProperties()
asProperties
in interface Configuration
public boolean containsKey(@Nonnull String key)
Configuration
containsKey
in interface Configuration
key
- the key to search@Nonnull public Map<String,Object> asFlatMap()
asFlatMap
in interface Configuration
@Nonnull public ResourceBundle asResourceBundle()
asResourceBundle
in interface Configuration