T
- the type of the target object.public abstract class ClassConfiguration<T> extends Object
Application.getConfiguration(Class)
method returns such objects as a way to find properties attached to particular classes.Modifier and Type | Method and Description |
---|---|
Map<String,String> |
asMap()
Returns the class configuration as an unmodifiable map.
|
boolean |
containsKey(String key)
Returns if the class configuration contains a particular key.
|
static <T> ClassConfiguration<T> |
empty(Class<T> targetClass)
Create an empty class configuration for the specified class.
|
Set<Map.Entry<String,String>> |
entrySet()
Returns an unmodifiable set of the key/value pairs as map entries.
|
void |
forEach(BiConsumer<? super String,? super String> action)
Walks the key/value pairs and provides them to the specified
BiConsumer . |
String |
get(String key)
Returns the value of a particular key (or null of the key doesn't exist).
|
String |
getOrDefault(String key,
String defaultValue)
Returns the value of a particular key (or the default value of the key doesn't exist).
|
Class<T> |
getTargetClass() |
boolean |
isEmpty()
Returns if the class configuration is empty or not.
|
Set<String> |
keySet()
Returns an unmodifiable set of all the keys.
|
ClassConfiguration<T> |
merge(ClassConfiguration<T> other)
Merge the class configuration with another one, overriding the existing values having an identical key.
|
static <T> ClassConfiguration<T> |
of(Class<T> targetClass,
Map<String,String> source)
Create a class configuration for the specified class, with the specified properties.
|
static <T> ClassConfiguration<T> |
of(Class<T> targetClass,
String... keyValuePairs)
Create a class configuration for the specified class, with the specified properties.
|
int |
size()
Returns the number of key/value pairs.
|
Collection<String> |
values()
Returns an unmodifiable collection of all the values.
|
public static <T> ClassConfiguration<T> of(Class<T> targetClass, Map<String,String> source)
T
- the type of the target object.targetClass
- the class this configuration refers to.source
- the source properties.public static <T> ClassConfiguration<T> of(Class<T> targetClass, String... keyValuePairs)
T
- the type of the target object.targetClass
- the class this configuration refers to.keyValuePairs
- key/value pairs forming properties .public static <T> ClassConfiguration<T> empty(Class<T> targetClass)
T
- the type of the target object.targetClass
- the class this configuration refers to.public int size()
public boolean isEmpty()
public boolean containsKey(String key)
key
- the key to check for.public String get(String key)
key
- the key to retrieve the value of.public Set<String> keySet()
public Collection<String> values()
public Set<Map.Entry<String,String>> entrySet()
public String getOrDefault(String key, String defaultValue)
key
- the key to retrieve the value of.defaultValue
- the default value.public void forEach(BiConsumer<? super String,? super String> action)
BiConsumer
.action
- the BiConsumer
that is invoked with each key/value pair.public Map<String,String> asMap()
public ClassConfiguration<T> merge(ClassConfiguration<T> other)
other
- the other class configuration.Copyright © 2013-2018–2019 SeedStack. All rights reserved.