java.util.Properties.merge()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中java.util.Properties.merge()方法的一些代码示例,展示了Properties.merge()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.merge()方法的具体详情如下:
包路径:java.util.Properties
类名称:Properties
方法名:merge

Properties.merge介绍

暂无

代码示例

代码示例来源:origin: apache/hive

@Override
public synchronized Object merge(Object key, Object value, BiFunction remappingFunction) {
 if (interned != null) copyFromInternedToThis();
 return super.merge(key, value, remappingFunction);
}

代码示例来源:origin: mulesoft/mule

/**
  * Loads the {@link RunnerModuleUtils#EXCLUDED_PROPERTIES_FILE} resources files, merges the entries so only one
  * {@link Properties} is returned with all values.
  *
  * @return a {@link Properties} loaded with the content of the file.
  * @throws IOException if the properties couldn't load the file.
  * @throws IllegalStateException if the file couldn't be found.
  */
 public static final Properties getExcludedProperties() throws IllegalStateException, IOException {
  Properties excludedProperties = new Properties();
  discoverProperties(EXCLUDED_PROPERTIES_FILE).stream()
    .forEach(properties -> properties.forEach((k, v) -> excludedProperties.merge(k, v, (v1, v2) -> v1 + "," + v2)));
  return excludedProperties;
 }
}

代码示例来源:origin: org.apache.hive/hive-common

@Override
public synchronized Object merge(Object key, Object value, BiFunction remappingFunction) {
 if (interned != null) copyFromInternedToThis();
 return super.merge(key, value, remappingFunction);
}

代码示例来源:origin: org.mule.tests/mule-tests-runner

/**
  * Loads the {@link RunnerModuleUtils#EXCLUDED_PROPERTIES_FILE} resources files, merges the entries so only one
  * {@link Properties} is returned with all values.
  *
  * @return a {@link Properties} loaded with the content of the file.
  * @throws IOException if the properties couldn't load the file.
  * @throws IllegalStateException if the file couldn't be found.
  */
 public static final Properties getExcludedProperties() throws IllegalStateException, IOException {
  Properties excludedProperties = new Properties();
  discoverProperties(EXCLUDED_PROPERTIES_FILE).stream()
    .forEach(properties -> properties.forEach((k, v) -> excludedProperties.merge(k, v, (v1, v2) -> v1 + "," + v2)));
  return excludedProperties;
 }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

@Override
public synchronized Object merge(Object key, Object value,
    BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
  Objects.requireNonNull(remappingFunction);
  // If the specified key is not already associated with a value or is associated with null, associates it with
  // the given non-null value.
  if (get(key) == null) {
    putIfAbsent(key, value);
    return value;
  }
  if (CRYPTO_PROPS.contains(key)) { // Crypto properties are not themselves encrypted
    Object newValue = super.merge(key, value, remappingFunction);
    resetCrypto();
    return newValue;
  }
  String sKey = (String) key;
  String sValue = (String) value;
  if (Crypto.isEncrypted(sValue)) {
    encrypted.put(sKey, sValue);
    sValue = new String(crypto.decrypt(sValue));
  }
  return super.merge(sKey, sValue, remappingFunction);
}

相关文章

微信公众号

最新文章

更多