@CompileStatic public class CompositeConfig extends java.lang.Object implements Config
A Config composed of other Configs. A lookup answers from the first config, in order of precedence, that has the key, and the java.util.Map views, flatten() and toProperties() resolve a key shared by several configs the same way, so each key appears once with its highest-precedence value.
One case differs: toProperties() combines the names each config exports, and a config leaves out the
dotted name that only repeats one of its own bracketed names; flatten() combines the maps the configs
store, which never hold that dotted name. So when a higher config spells a property in brackets,
app.routes[k], and a lower one dotted, app.routes.k, the dotted name keeps the lower value there,
while getProperty(String) answers the higher one.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addFirst(Config config)Adds a config at the highest level of precedence |
|
public void |
addLast(Config config)Adds a config at the lowest level of precedence |
|
public void |
clear() |
|
public boolean |
containsKey(java.lang.Object key) |
|
public boolean |
containsProperty(java.lang.String key) |
|
public boolean |
containsValue(java.lang.Object value) |
|
public java.util.Set<Map.Entry<java.lang.String, java.lang.Object>> |
entrySet() |
|
public java.util.Map<java.lang.String, java.lang.Object> |
flatten() |
|
public java.lang.Object |
get(java.lang.Object key)The value of the highest precedence config that has the key. |
|
public java.lang.Object |
getAt(java.lang.Object key) |
<T> |
public T |
getProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue, java.util.List<T> allowedValues) |
|
public java.lang.String |
getProperty(java.lang.String key, java.lang.String defaultValue) |
<T> |
public T |
getProperty(java.lang.String key, java.lang.Class<T> targetType) |
<T> |
public T |
getProperty(java.lang.String key, java.lang.Class<T> targetType, T defaultValue) |
|
public java.lang.String |
getProperty(java.lang.String key) |
|
public java.lang.String |
getRequiredProperty(java.lang.String key) |
<T> |
public T |
getRequiredProperty(java.lang.String key, java.lang.Class<T> targetType) |
|
public boolean |
isEmpty() |
|
public java.util.Iterator<Map.Entry<java.lang.String, java.lang.Object>> |
iterator() |
|
public java.util.Set<java.lang.String> |
keySet() |
|
public Config |
merge(java.util.Map<java.lang.String, java.lang.Object> toMerge) |
|
public java.lang.Object |
navigate(java.lang.String path) |
|
public java.lang.Object |
put(java.lang.String key, java.lang.Object value) |
|
public void |
putAll(java.util.Map<? extends java.lang.String, ?> m) |
|
public java.lang.Object |
remove(java.lang.Object key) |
|
public java.lang.String |
resolvePlaceholders(java.lang.String text) |
|
public java.lang.String |
resolveRequiredPlaceholders(java.lang.String text) |
|
public void |
setAt(java.lang.Object key, java.lang.Object value) |
|
public int |
size() |
|
public java.util.Properties |
toProperties() |
|
public java.util.Collection<java.lang.Object> |
values() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Adds a config at the highest level of precedence
Adds a config at the lowest level of precedence
The value of the highest precedence config that has the key. A config answers a key it does not have with a navigator for the keys below it, so a config is only asked when it has the key, and the first answer of any config is returned only when none has it.