org.springframework.core.env.MapPropertySource.containsProperty()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(70)

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

MapPropertySource.containsProperty介绍

暂无

代码示例

代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba

/**
 * Copy from {@link BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)}
 *
 * @param propertySources {@link MutablePropertySources}
 * @param map             Default RocketMQ Bus Properties
 */
private void addOrReplace(MutablePropertySources propertySources,
             Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: apache/incubator-dubbo-spring-boot-project

/**
   * Copy from BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)
   *
   * @param propertySources {@link MutablePropertySources}
   * @param map             Default Dubbo Properties
   */
  private void addOrReplace(MutablePropertySources propertySources,
               Map<String, Object> map) {
    MapPropertySource target = null;
    if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
      PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
      if (source instanceof MapPropertySource) {
        target = (MapPropertySource) source;
        for (String key : map.keySet()) {
          if (!target.containsProperty(key)) {
            target.getSource().put(key, map.get(key));
          }
        }
      }
    }
    if (target == null) {
      target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
    }
    if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
      propertySources.addLast(target);
    }
  }
}

代码示例来源:origin: spring-io/initializr

private static void addOrReplace(MutablePropertySources propertySources,
    Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

private void addOrReplace(MutablePropertySources propertySources,
    Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
   * Check to see if this property source contains a property with the given name, or
   * any underscore / uppercase variation thereof. Return the resolved name or
   * {@code null} if none found.
   */
  private String resolvePropertyName(String name) {
    if (super.containsProperty(name)) {
      return name;
    }

    String usName = name.replace('.', '_');
    if (!name.equals(usName) && super.containsProperty(usName)) {
      return usName;
    }

    String ucName = name.toUpperCase();
    if (!name.equals(ucName)) {
      if (super.containsProperty(ucName)) {
        return ucName;
      } else {
        String usUcName = ucName.replace('.', '_');
        if (!ucName.equals(usUcName) && super.containsProperty(usUcName)) {
          return usUcName;
        }
      }
    }

    return null;
  }
}

代码示例来源:origin: com.microsoft.azure/azure-spring-boot

@SuppressFBWarnings("WMI_WRONG_MAP_ITERATOR")
private void addOrReplace(MutablePropertySources propertySources,
             Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    final PropertySource<?> source = propertySources
        .get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (final Entry<String, Object> entry : map.entrySet()) {
        if (!target.containsProperty(entry.getKey())) {
          target.getSource().put(entry.getKey(), map.get(entry.getKey()));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: com.microsoft.azure/azure-support

@SuppressFBWarnings("WMI_WRONG_MAP_ITERATOR")
private void addOrReplace(MutablePropertySources propertySources,
             Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    final PropertySource<?> source = propertySources
        .get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (final Entry<String, Object> entry : map.entrySet()) {
        if (!target.containsProperty(entry.getKey())) {
          target.getSource().put(entry.getKey(), map.get(entry.getKey()));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: Microsoft/azure-spring-boot

@SuppressFBWarnings("WMI_WRONG_MAP_ITERATOR")
private void addOrReplace(MutablePropertySources propertySources,
             Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    final PropertySource<?> source = propertySources
        .get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (final Entry<String, Object> entry : map.entrySet()) {
        if (!target.containsProperty(entry.getKey())) {
          target.getSource().put(entry.getKey(), map.get(entry.getKey()));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-bus

private void addOrReplace(MutablePropertySources propertySources,
    Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-bus

private void addOrReplace(MutablePropertySources propertySources,
    Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core

private void addOrReplace(MutablePropertySources propertySources,
    Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
    PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
    if (source instanceof MapPropertySource) {
      target = (MapPropertySource) source;
      for (String key : map.keySet()) {
        if (!target.containsProperty(key)) {
          target.getSource().put(key, map.get(key));
        }
      }
    }
  }
  if (target == null) {
    target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
    propertySources.addLast(target);
  }
}

代码示例来源:origin: io.opentracing.contrib/opentracing-spring-cloud-core

private void addOrReplace(MutablePropertySources propertySources,
   Map<String, Object> map) {
  MapPropertySource target = null;
  if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
   PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
   if (source instanceof MapPropertySource) {
    target = (MapPropertySource) source;
    for (String key : map.keySet()) {
     if (!target.containsProperty(key)) {
      target.getSource().put(key, map.get(key));
     }
    }
   }
  }
  if (target == null) {
   target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
  }
  if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
   propertySources.addLast(target);
  }
 }
}

代码示例来源:origin: com.alibaba.boot/dubbo-spring-boot-autoconfigure

/**
   * Copy from BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)
   *
   * @param propertySources {@link MutablePropertySources}
   * @param map             Default Dubbo Properties
   */
  private void addOrReplace(MutablePropertySources propertySources,
               Map<String, Object> map) {
    MapPropertySource target = null;
    if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
      PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
      if (source instanceof MapPropertySource) {
        target = (MapPropertySource) source;
        for (String key : map.keySet()) {
          if (!target.containsProperty(key)) {
            target.getSource().put(key, map.get(key));
          }
        }
      }
    }
    if (target == null) {
      target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
    }
    if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
      propertySources.addLast(target);
    }
  }
}

相关文章