List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:com.google.mr4c.config.ConfigUtils.java
public static Set<String> findUnresolvedProperties(Properties props) { Set<String> result = new HashSet<String>(); for (String name : props.stringPropertyNames()) { String val = props.getProperty(name); if (containsVariables(val)) { result.add(name);//from w w w. jav a 2 s. c o m } } return result; }
From source file:com.google.mr4c.hadoop.HadoopUtils.java
public static void applyToJobConf(Properties props, JobConf conf) { for (String name : props.stringPropertyNames()) { conf.set(name, props.getProperty(name)); }//from w w w . jav a 2 s.co m }
From source file:org.apache.isis.core.runtime.runner.opts.OptionHandlerSystemProperties.java
private static Map<String, String> asMap(Properties properties) { final Map<String, String> map = Maps.newTreeMap(); for (String key : properties.stringPropertyNames()) { final String value = properties.getProperty(key); if (key.startsWith("isis.")) { map.put(key, value);//from ww w. ja v a2 s.c o m } } return map; }
From source file:Main.java
public static Map<String, String> toMap(String properties) { try {/*from www . j av a2s. c om*/ InputStream is = new ByteArrayInputStream(properties.getBytes("UTF-8")); Properties prop = new Properties(); prop.load(is); Map<String, String> ret = new HashMap<String, String>(); for (String key : prop.stringPropertyNames()) { ret.put(key, prop.getProperty(key)); } return ret; } catch (Exception ex) { ex.printStackTrace(); } return null; }
From source file:com.cognifide.qa.bb.utils.PropertyUtils.java
private static void setSystemProperties(Properties properties) { for (String key : properties.stringPropertyNames()) { String systemProperty = System.getProperty(key); if (StringUtils.isNotBlank(systemProperty)) { continue; }//from www .ja va2 s. c om for (String prefix : PREFIXES) { if (key.startsWith(prefix)) { System.setProperty(key, properties.getProperty(key)); break; } } } }
From source file:gobblin.util.JobConfigurationUtils.java
/** * Put all configuration properties in a given {@link Properties} object into a given * {@link Configuration} object./*ww w .j a va 2 s .c o m*/ * * @param properties the given {@link Properties} object * @param configuration the given {@link Configuration} object */ public static void putPropertiesIntoConfiguration(Properties properties, Configuration configuration) { for (String name : properties.stringPropertyNames()) { configuration.set(name, properties.getProperty(name)); } }
From source file:org.opensingular.lib.commons.util.PropertiesUtils.java
public static void copyTo(Properties source, Properties destination) { if (source != null) { for (String propertyName : source.stringPropertyNames()) destination.put(propertyName, source.getProperty(propertyName)); }//from www .j a v a 2 s . c o m }
From source file:com.cloud.utils.PropertiesUtil.java
public static Map<String, Object> toMap(Properties props) { Set<String> names = props.stringPropertyNames(); HashMap<String, Object> map = new HashMap<String, Object>(names.size()); for (String name : names) { map.put(name, props.getProperty(name)); }/*from ww w. j a va 2s .c om*/ return map; }
From source file:org.seedstack.seed.core.utils.SeedBeanUtils.java
/** * Set properties derived from configuration on a bean. * * <ul>/*www . j ava2 s. c o m*/ * <li>[prefix].property.* gives the properties to set.</li> * </ul> * * @param bean the bean to set properties on. * @param configuration the configuration to derive properties from. * @param prefix the property prefix. */ public static void setPropertiesFromConfiguration(Object bean, Configuration configuration, String prefix) { BeanMap beanMap = new BeanMap(bean); Properties properties = SeedConfigurationUtils.buildPropertiesFromConfiguration(configuration, prefix); for (String key : properties.stringPropertyNames()) { String value = properties.getProperty(key); try { PropertyDescriptor propertyDescriptor = PropertyUtils.getPropertyDescriptor(bean, key); if (propertyDescriptor == null) { throw SeedException.createNew(CoreUtilsErrorCode.PROPERTY_NOT_FOUND).put("property", key) .put("class", bean.getClass().getCanonicalName()); } beanMap.put(key, value); } catch (Exception e) { throw SeedException.wrap(e, CoreUtilsErrorCode.UNABLE_TO_SET_PROPERTY).put("property", key) .put("class", bean.getClass().getCanonicalName()).put("value", value); } } }
From source file:org.jaggeryjs.hostobjects.process.ProcessHostObject.java
public static Scriptable getProperties(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws ScriptException { String functionName = "getProperties"; int argsCount = args.length; if (argsCount != 0) { HostObjectUtil.invalidNumberOfArgs(MODULE_NAME, functionName, argsCount, false); }/*from ww w.ja v a2 s . c o m*/ Properties properties = System.getProperties(); Scriptable object = cx.newObject(thisObj); for (String name : properties.stringPropertyNames()) { object.put(name, object, properties.getProperty(name)); } return object; }