DataConfiguration config = new DataConfiguration(new AppletConfiguration(applet)); Color color = config.getColor("color");
@Override public Object getValue(String prefix, String key, Field field, Configuration configuration) throws DemoiselleConfigurationValueExtractorException { try{ return new DataConfiguration(configuration).getArray(field.getType().getComponentType(), prefix + key); } catch(Exception e){ throw new DemoiselleConfigurationValueExtractorException(e.getMessage(), e); } }
@Override public Object getValue(String prefix, String key, Field field, Configuration configuration) throws DemoiselleConfigurationValueExtractorException { try{ return new DataConfiguration(configuration).get(ClassUtils.primitiveToWrapper(field.getType()), prefix + key); } catch(Exception e){ throw new DemoiselleConfigurationValueExtractorException(e.getMessage(), e); } }
/** * (Re)create and populate the initial config. */ 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); }