List of usage examples for org.apache.commons.configuration2 DataConfiguration DataConfiguration
public DataConfiguration(final Configuration configuration)
From source file:org.demoiselle.internal.implementation.ConfigurationArrayValueExtractor.java
@Override public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception { return new DataConfiguration(configuration).getArray(field.getType().getComponentType(), prefix + key); }
From source file:org.demoiselle.internal.implementation.ConfigurationPrimitiveOrWrapperValueExtractor.java
@Override @SuppressWarnings("unchecked") public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception { Object value;//w ww.j a v a 2 s .co m try { value = new DataConfiguration(configuration).get(ClassUtils.primitiveToWrapper(field.getType()), prefix + key); } catch (ConversionException cause) { throw cause; } return value; }
From source file:org.linqs.psl.config.Config.java
/** * (Re)create and populate the initial config. */// ww w.ja v a 2 s . c o m public static void init() { config = new DataConfiguration(new BaseConfiguration()); // Load maven project properties. InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(PROJECT_PROPS); if (stream != null) { loadResource(stream, PROJECT_PROPS); } // Load the configuration file directly if the path exists. String path = OptionConverter.getSystemProperty(PSL_CONFIG, PSL_CONFIG_DEFAULT); if ((new File(path)).isFile()) { loadResource(path); return; } // Try to get a resource URL from the system (if we have a property key instead of a path). stream = ClassLoader.getSystemClassLoader().getResourceAsStream(path); if (stream != null) { loadResource(stream, PSL_CONFIG); return; } log.debug("PSL configuration {} file not found." + " Only default values will be used unless additional properties are specified.", path); }