class EnvVarResolverProperties extends Properties {

  protected static String resolveEnvVars(String input) {
    Preconditions.checkNotNull(input);
    // match ${ENV_VAR_NAME}
    Pattern p = Pattern.compile("\\$\\{(\\w+)\\}");
    Matcher m = p.matcher(input);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
      String envVarName = m.group(1);
      String envVarValue = System.getenv(envVarName);
      m.appendReplacement(sb, null == envVarValue ? "" : envVarValue);
    }
    m.appendTail(sb);
    return sb.toString();
  }

}