org.openstreetmap.atlas.utilities.configuration.Configuration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atlas Show documentation
Show all versions of atlas Show documentation
"Library to load OSM data into an Atlas format"
package org.openstreetmap.atlas.utilities.configuration;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
/**
* Configuration interface providing key-value look with support for defaults and transformations.
*
* @author brian_l_davis
*/
public interface Configuration
{
/**
* Returns a set view of all the top level keys in this {@link Configuration}.
*
* @return the set of top level keys
*/
Set configurationDataKeySet();
/**
* Returns a returns a copy Configuration specific to a keyword with overwritten values
*
* @param keyword
* keyword string
* @return Configuration
*/
Configuration configurationForKeyword(String keyword);
/**
* Returns a {@link Configurable} wrapper around the configured property.
*
* @param key
* property key
* @return a {@link Configurable} wrapper
*/
Configurable get(String key);
/**
* Returns a {@link Configurable} wrapper around the configured property.
*
* @param key
* property key
* @param transform
* applied to the configured property
* @param
* configured type
* @param
* transformed type
* @return a {@link Configurable} wrapper
*/
Configurable get(String key, Function transform);
/**
* Returns a {@link Configurable} wrapper around the configured property.
*
* @param key
* property key
* @param defaultValue
* value returned if not found in the configuration
* @param transform
* applied to the configured property
* @param
* configured type
* @param
* transformed type
* @return a {@link Configurable} wrapper
*/
Configurable get(String key, R defaultValue, Function transform);
/**
* Returns a {@link Configurable} wrapper around the configured property.
*
* @param key
* property key
* @param defaultValue
* value returned if not found in the configuration
* @param
* configured type
* @return a {@link Configurable} wrapper
*/
Configurable get(String key, T defaultValue);
/**
* Returns a new configuration with contents starting at the provided key.
*
* Assuming the initial configuration is:
*
*
* {@code
* {
* "a" :
* {
* "b" : "c"
* }
*
* }
* }
*
*
* With a key provided as "a", the new sub configuration looks like:
*
*
* {@code
* {
* "b" : "c"
* }
* }
*
*
* @param key
* The provided key
* @return The sub Configuration if it exists under the key, Optional.empty otherwise.
*/
Optional subConfiguration(String key);
}