public abstract class AbstractConfiguration extends java.lang.Object implements Configuration
Constructor and Description |
---|
AbstractConfiguration() |
Modifier and Type | Method and Description |
---|---|
java.util.Properties |
asProperties() |
protected <T> T |
convertValue(java.lang.Object value,
java.lang.Class<T> type) |
protected <T> T |
convertValue(java.lang.Object value,
java.lang.Class<T> type,
java.lang.String format) |
<T> T |
get(java.lang.String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getAs(java.lang.String key)
/**
Finds a value associated with the given key.
|
<T> T |
getAs(java.lang.String key,
T defaultValue)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(java.lang.String key)
Finds a value associated with the given key.
|
boolean |
getAsBoolean(java.lang.String key,
boolean defaultValue)
Finds a value associated with the given key.
|
double |
getAsDouble(java.lang.String key)
Finds a value associated with the given key.
|
double |
getAsDouble(java.lang.String key,
double defaultValue)
Finds a value associated with the given key.
|
float |
getAsFloat(java.lang.String key)
Finds a value associated with the given key.
|
float |
getAsFloat(java.lang.String key,
float defaultValue)
Finds a value associated with the given key.
|
int |
getAsInt(java.lang.String key)
Finds a value associated with the given key.
|
int |
getAsInt(java.lang.String key,
int defaultValue)
Finds a value associated with the given key.
|
long |
getAsLong(java.lang.String key)
Finds a value associated with the given key.
|
long |
getAsLong(java.lang.String key,
long defaultValue)
Finds a value associated with the given key.
|
java.lang.String |
getAsString(java.lang.String key)
Finds a value associated with the given key.
|
java.lang.String |
getAsString(java.lang.String key,
java.lang.String defaultValue)
Finds a value associated with the given key.
|
java.lang.Object |
getAt(java.lang.String key)
Returns the value associated with the given key.
|
<T> T |
getAt(java.lang.String key,
T defaultValue)
Returns the value associated with the given key.
|
<T> T |
getConverted(java.lang.String key,
java.lang.Class<T> type)
Finds a value associated with the given key.
|
<T> T |
getConverted(java.lang.String key,
java.lang.Class<T> type,
java.lang.String format)
Finds a value associated with the given key.
|
<T> T |
getConverted(java.lang.String key,
java.lang.Class<T> type,
java.lang.String format,
T defaultValue)
Finds a value associated with the given key.
|
<T> T |
getConverted(java.lang.String key,
java.lang.Class<T> type,
T defaultValue)
Finds a value associated with the given key.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asFlatMap, asResourceBundle, containsKey, get
@Nullable public <T> T get(@Nonnull java.lang.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 java.lang.Object getAt(@Nonnull java.lang.String key)
Configuration
getAt
in interface Configuration
key
- the key to search@Nullable public <T> T getAt(@Nonnull java.lang.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 java.lang.String key)
Configuration
getAsBoolean
in interface Configuration
key
- the key to searchpublic boolean getAsBoolean(@Nonnull java.lang.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 java.lang.String key)
Configuration
getAsInt
in interface Configuration
key
- the key to searchpublic int getAsInt(@Nonnull java.lang.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 java.lang.String key)
Configuration
getAsLong
in interface Configuration
key
- the key to searchpublic long getAsLong(@Nonnull java.lang.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 java.lang.String key)
Configuration
getAsFloat
in interface Configuration
key
- the key to searchpublic float getAsFloat(@Nonnull java.lang.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 java.lang.String key)
Configuration
getAsDouble
in interface Configuration
key
- the key to searchpublic double getAsDouble(@Nonnull java.lang.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 java.lang.String getAsString(@Nonnull java.lang.String key)
Configuration
getAsString
in interface Configuration
key
- the key to search@Nullable public <T> T getAs(@Nonnull java.lang.String key)
Configuration
getAs
in interface Configuration
key
- the key to search@Nullable public <T> T getAs(@Nonnull java.lang.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 java.lang.String key, @Nonnull java.lang.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 java.lang.String key, @Nonnull java.lang.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@Nullable public <T> T getConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Class<T> type, @Nonnull java.lang.String format)
Configuration
PropertyEditor
.getConverted
in interface Configuration
key
- the key to searchtype
- the type to be returnedformat
- format used to convert the value@Nullable public <T> T getConverted(@Nonnull java.lang.String key, @Nonnull java.lang.Class<T> type, @Nonnull java.lang.String format, @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 returnedformat
- format used to convert the valuedefaultValue
- the value to be returned if the key is not foundprotected <T> T convertValue(@Nullable java.lang.Object value, @Nonnull java.lang.Class<T> type)
protected <T> T convertValue(@Nullable java.lang.Object value, @Nonnull java.lang.Class<T> type, @Nonnull java.lang.String format)
@Nullable public java.lang.String getAsString(@Nonnull java.lang.String key, @Nullable java.lang.String defaultValue)
Configuration
getAsString
in interface Configuration
key
- the key to searchdefaultValue
- the value to be returned if the key is not found@Nonnull public java.util.Properties asProperties()
asProperties
in interface Configuration