org.jgroups.util.Util.substituteVariable()方法的使用及代码示例

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

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

Util.substituteVariable介绍

[英]Replaces variables of ${var:default} with System.getProperty(var, default). If no variables are found, returns the same string, otherwise a copy of the string with variables substituted
[中]用系统替换${var:default}的变量。getProperty(变量,默认值)。如果未找到变量,则返回相同的字符串,否则返回替换了变量的字符串副本

代码示例

代码示例来源:origin: wildfly/wildfly

public void substituteVariables() {
  for(Iterator<Map.Entry<String, String>> it=properties.entrySet().iterator(); it.hasNext();) {
    Map.Entry<String, String> entry=it.next();
    String key=entry.getKey();
    String val=entry.getValue();
    String tmp=Util.substituteVariable(val);
    if(!val.equals(tmp)) {
      properties.put(key, tmp);
    }
    else {
      if(tmp.contains("${"))
        it.remove();
    }
  }
  properties_str=propertiesToString();
}

代码示例来源:origin: wildfly/wildfly

/**
   * Replace variables of the form ${var:default} with the getProperty(var,
   * default)
   * 
   * @param configurator
   */
  public static void substituteVariables(ProtocolStackConfigurator configurator) {
    List<ProtocolConfiguration> protocols=configurator.getProtocolStack();
    protocols.stream().filter(data -> data != null).forEach(data -> {
      Map<String,String> parms=data.getProperties();
      for(Map.Entry<String,String> entry : parms.entrySet()) {
        String val=entry.getValue();
        String replacement=Util.substituteVariable(val);
        if(!replacement.equals(val)) {
          entry.setValue(replacement);
        }
      }
    });
  }          
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void substituteVariables() {
  for(Iterator<Map.Entry<String, String>> it=properties.entrySet().iterator(); it.hasNext();) {
    Map.Entry<String, String> entry=it.next();
    String key=entry.getKey();
    String val=entry.getValue();
    String tmp=Util.substituteVariable(val);
    if(!val.equals(tmp)) {
      properties.put(key, tmp);
    }
    else {
      if(tmp.contains("${"))
        it.remove();
    }
  }
  properties_str=propertiesToString();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
   * Replace variables of the form ${var:default} with the getProperty(var,
   * default)
   * 
   * @param configurator
   */
  public static void substituteVariables(ProtocolStackConfigurator configurator) {
    List<ProtocolConfiguration> protocols=configurator.getProtocolStack();
    protocols.stream().filter(data -> data != null).forEach(data -> {
      Map<String,String> parms=data.getProperties();
      for(Map.Entry<String,String> entry : parms.entrySet()) {
        String val=entry.getValue();
        String replacement=Util.substituteVariable(val);
        if(!replacement.equals(val)) {
          entry.setValue(replacement);
        }
      }
    });
  }          
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

parm=(ProtocolParameter)entry.getValue();
String val=parm.getValue();
String replacement=Util.substituteVariable(val);
if(!replacement.equals(val)) {
  parm.setValue(replacement);

相关文章

Util类方法