本文整理了Java中java.util.Properties.get()
方法的一些代码示例,展示了Properties.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.get()
方法的具体详情如下:
包路径:java.util.Properties
类名称:Properties
方法名:get
[英]Searches for the property with the specified name. If the property is not found, the default Properties are checked. If the property is not found in the default Properties, null is returned.
[中]搜索具有指定名称的属性。如果未找到该属性,则会选中默认属性。如果在默认属性中找不到该属性,则返回null。
代码示例来源:origin: spring-projects/spring-framework
/**
* Merge the given Properties instance into the given Map,
* copying all properties (key-value pairs) over.
* <p>Uses {@code Properties.propertyNames()} to even catch
* default properties linked into the original Properties instance.
* @param props the Properties instance to merge (may be {@code null})
* @param map the target Map to merge the properties into
*/
@SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(@Nullable Properties props, Map<K, V> map) {
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) {
String key = (String) en.nextElement();
Object value = props.get(key);
if (value == null) {
// Allow for defaults fallback or potentially overridden accessor...
value = props.getProperty(key);
}
map.put((K) key, (V) value);
}
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
public Settings merge(Properties properties) {
if (properties == null || properties.isEmpty()) {
return this;
}
Enumeration<?> propertyNames = properties.propertyNames();
Object prop = null;
for (; propertyNames.hasMoreElements();) {
prop = propertyNames.nextElement();
if (prop instanceof String) {
Object value = properties.get(prop);
setProperty((String) prop, value.toString());
}
}
return this;
}
代码示例来源:origin: org.glassfish.admin/cli-framework
/** Creates a new instance of LocalStringsManager from the
properties Vector
*/
public LocalStringsManager(Vector<Properties> localizePropertiesList)
{
this.packageName = null;
this.propertyFile = null;
for (int i = 0; i < localizePropertiesList.size(); i++)
{
Properties properties = localizePropertiesList.get(i);
String packageNameStr = (String) properties.get("base-package");
String propertyFileStr = (String) properties.get("property-file-name");
ResourceBundle resourceBundle =
ResourceBundle.getBundle(packageNameStr + "." + propertyFileStr);
resourceBundles.add(resourceBundle);
}
}
代码示例来源:origin: OpenNMS/opennms
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
代码示例来源:origin: uk.org.mygrid.feta/feta-engine
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
代码示例来源:origin: SonarSource/sonarqube
public static Properties interpolateVariables(Properties properties, Map<String, String> variables) {
Properties result = new Properties();
Enumeration keys = properties.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = (String) properties.get(key);
String interpolatedValue = StrSubstitutor.replace(value, variables, "${env:", "}");
result.setProperty(key, interpolatedValue);
}
return result;
}
代码示例来源:origin: OpenNMS/opennms
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
代码示例来源:origin: robovm/robovm
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
sb.append(key);
sb.append('=');
Properties def = defaults;
while (property == null) {
property = (String) def.get(key);
def = def.defaults;
代码示例来源:origin: jlfex/hermes
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
Enumeration<Object> keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
代码示例来源:origin: sc.fiji/VIB-lib
void initializeMaterials() {
if(materials==null)
materials=new Vector();
String list=(String)parameters.get("MaterialList");
if(list==null) {
list="";
for(int i=0;i<materials.size();i++)
list+=(i>0?",":"")+(String)materials.get(i);
parameters.put("MaterialList",list);
} else {
materials.clear();
StringTokenizer t=new StringTokenizer(list,",");
while(t.hasMoreTokens())
materials.add(t.nextToken());
}
}
代码示例来源:origin: org.springframework/spring-core
/**
* Merge the given Properties instance into the given Map,
* copying all properties (key-value pairs) over.
* <p>Uses {@code Properties.propertyNames()} to even catch
* default properties linked into the original Properties instance.
* @param props the Properties instance to merge (may be {@code null})
* @param map the target Map to merge the properties into
*/
@SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(@Nullable Properties props, Map<K, V> map) {
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) {
String key = (String) en.nextElement();
Object value = props.get(key);
if (value == null) {
// Allow for defaults fallback or potentially overridden accessor...
value = props.getProperty(key);
}
map.put((K) key, (V) value);
}
}
}
代码示例来源:origin: com.google.api-ads/adwords-axis
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
代码示例来源:origin: apache/hbase
while(nics.hasMoreElements()) {
Enumeration<?> rawAdrs =
((NetworkInterface)nics.nextElement()).getInetAddresses();
while(rawAdrs.hasMoreElements()) {
InetAddress inet = (InetAddress) rawAdrs.nextElement();
ips.add(StringUtils.simpleHostname(inet.getHostName()));
ips.add(inet.getHostAddress());
String dataDirStr = properties.get("dataDir").toString().trim();
File dataDir = new File(dataDirStr);
if (!dataDir.isDirectory()) {
代码示例来源:origin: jwtk/jjwt
/**
* Merge the given Properties instance into the given Map,
* copying all properties (key-value pairs) over.
* <p>Uses <code>Properties.propertyNames()</code> to even catch
* default properties linked into the original Properties instance.
* @param props the Properties instance to merge (may be <code>null</code>)
* @param map the target Map to merge the properties into
*/
@SuppressWarnings("unchecked")
public static void mergePropertiesIntoMap(Properties props, Map map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
if (props != null) {
for (Enumeration en = props.propertyNames(); en.hasMoreElements();) {
String key = (String) en.nextElement();
Object value = props.getProperty(key);
if (value == null) {
// Potentially a non-String value...
value = props.get(key);
}
map.put(key, value);
}
}
}
代码示例来源:origin: com.google.api-ads/adwords-axis
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
代码示例来源:origin: xalan/xalan
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = (String) _properties.get(name);
代码示例来源:origin: deeplearning4j/nd4j
public static void mergePropertiesIntoMap(Properties props, Map map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
} else {
String key;
Object value;
if (props != null) {
for (Enumeration en = props.propertyNames(); en.hasMoreElements(); map.put(key, value)) {
key = (String) en.nextElement();
value = props.getProperty(key);
if (value == null) {
value = props.get(key);
}
}
}
}
}
代码示例来源:origin: com.google.api-ads/adwords-axis
_call.setUsername(super.cachedUsername);
_call.setTimeout(super.cachedTimeout);
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
代码示例来源:origin: xalan/xalan
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = (String) _properties.get(name);
代码示例来源:origin: alibaba/easyexcel
/**
* Merge the given Properties instance into the given Map,
* copying all properties (key-value pairs) over.
* <p>Uses {@code Properties.propertyNames()} to even catch
* default properties linked into the original Properties instance.
* @param props the Properties instance to merge (may be {@code null})
* @param map the target Map to merge the properties into
*/
@SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) {
String key = (String) en.nextElement();
Object value = props.get(key);
if (value == null) {
// Allow for defaults fallback or potentially overridden accessor...
value = props.getProperty(key);
}
map.put((K) key, (V) value);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!