public class ConfigurationUtils
extends java.lang.Object
| Constructor and Description |
|---|
ConfigurationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static ConcurrentCompositeConfiguration |
convertToConcurrentCompositeConfiguration(CombinedConfiguration config)
Convert CombinedConfiguration into
ConcurrentCompositeConfiguration as the later has better performance
and thread safety. |
static void |
copyProperties(Configuration from,
Configuration to) |
static java.util.Map<java.lang.String,Configuration> |
getAllNamedConfiguration(Configuration conf)
Gets all named sub-configuration from a configuration in a map.
|
static AbstractConfiguration |
getConfigFromPropertiesFile(java.net.URL startingUrl,
java.util.Set<java.lang.String> loaded,
java.lang.String... nextLoadKeys) |
static java.util.Properties |
getProperties(Configuration config)
Utility method to obtain
Properties given an instance of AbstractConfiguration. |
static java.util.Properties |
getPropertiesFromFile(java.net.URL startingUrl,
java.util.Set<java.lang.String> loaded,
java.lang.String... nextLoadKeys) |
static void |
loadProperties(java.util.Properties props,
Configuration config) |
static java.util.Properties |
loadPropertiesFromInputStream(java.io.InputStream fin)
Load properties from InputStream with utf-8 encoding, and it will take care of closing the input stream.
|
public static ConcurrentCompositeConfiguration convertToConcurrentCompositeConfiguration(CombinedConfiguration config)
ConcurrentCompositeConfiguration as the later has better performance
and thread safety.config - Configuration to be convertedpublic static java.util.Map<java.lang.String,Configuration> getAllNamedConfiguration(Configuration conf)
ConcurrentCompositeConfiguration or CombinedConfiguration and extract the
named configurations out of them.conf - Configuration to get all the named sub-configurationspublic static java.util.Properties getProperties(Configuration config)
Properties given an instance of AbstractConfiguration.
Returns an empty Properties object if the config has no properties or is null.config - Configuration to get the propertiespublic static void loadProperties(java.util.Properties props,
Configuration config)
public static AbstractConfiguration getConfigFromPropertiesFile(java.net.URL startingUrl,
java.util.Set<java.lang.String> loaded,
java.lang.String... nextLoadKeys)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static void copyProperties(Configuration from,
Configuration to)
public static java.util.Properties getPropertiesFromFile(java.net.URL startingUrl,
java.util.Set<java.lang.String> loaded,
java.lang.String... nextLoadKeys)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static java.util.Properties loadPropertiesFromInputStream(java.io.InputStream fin)
throws java.io.IOException
fin - java.io.IOException