public abstract class AbstractConfiguration extends Object implements Configuration
Constructor and Description |
---|
AbstractConfiguration() |
Modifier and Type | Method and Description |
---|---|
Properties |
asProperties() |
protected <T> T |
convertValue(Object value,
Class<T> type) |
protected <T> T |
convertValue(Object value,
Class<T> type,
String format) |
<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,
String format)
Finds a value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type,
String format,
T defaultValue)
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asFlatMap, asResourceBundle, containsKey, get
@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 <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@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type, @Nonnull 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 String key, @Nonnull Class<T> type, @Nonnull 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 Object value, @Nonnull Class<T> type, @Nonnull String format)
@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@Nonnull public Properties asProperties()
asProperties
in interface Configuration