Package org.apache.commons.lang3.text

Examples of org.apache.commons.lang3.text.StrSubstitutor


      @Override
      public String lookup(String key) {
        return definition.parameterPathToSql(key).orNull();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here


        Optional<String> sqlName = definition.parameterNameToSql(key);
        JirmPrecondition.check.state(sqlName.isPresent(), "Property: {} not found in object.", key);
        return sqlName.get();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here

     *
     * @param expr expression string.
     * @return replaced string.
     */
    public String replaceVars(String expr) {
        StrSubstitutor s = new StrSubstitutor(this);
        return s.replace(expr);
    }
View Full Code Here

            if (additionals != null) {
                if (placeHolders == null) {
                    placeHolders = new HashMap<>();
                }

                final StrSubstitutor lookup = new StrSubstitutor(StrLookup.mapLookup(placeHolders));

                for (final String line : additionals) {
                    final StringBuilder builder = new StringBuilder(line);
                    if (hashAlgo != null) {
                        builder.append("|").append(Files.hash(urls(line, lookup), hashAlgo))
View Full Code Here

      @Override
      public String lookup(String key) {
        return parameterPathToSql(definition,key).orNull();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here

        Optional<String> sqlName = definition.parameterNameToSql(key);
        JirmPrecondition.check.state(sqlName.isPresent(), "Property: {} not found in object.", key);
        return sqlName.get();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here

        this.suffix = suffix;
    }

    @Override
    public String format(String pattern, Map<String, Object> paramMap) {
        StrSubstitutor sub = new StrSubstitutor(paramMap, prefix, suffix);
        return sub.replace(pattern);
    }
View Full Code Here

        check.state(p.isPresent(),
            "Invalid object path: {}", key);
        return p.get();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here

        Optional<String> sqlName = definition.parameterNameToSql(key);
        check.state(sqlName.isPresent(), "Property: {} not found in object.", key);
        return sqlName.get();
      }
    };
    StrSubstitutor s = new StrSubstitutor(lookup, "{{", "}}", '$');
    String result = s.replace(sql);
    return result;
  }
View Full Code Here

        .put("lang", lang)
        .put("should_match", matchAll ? "100%" : "-1");
    if(lon != null) params.put("lon", lon);
    if(lat != null) params.put("lat", lat);

    StrSubstitutor sub = new StrSubstitutor(params.build(), "${", "}");
    if(lon != null && lat != null) {
      query = sub.replace(queryLocationBiasTemplate);
    } else {
      query = sub.replace(queryTemplate);
    }

    SearchResponse response = client.prepareSearch("photon").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(query).setSize(limit).setTimeout(TimeValue.timeValueSeconds(7)).execute().actionGet();
    List<JSONObject> results = convert(response.getHits().getHits(), lang);
    results = removeStreetDuplicates(results);
View Full Code Here

TOP

Related Classes of org.apache.commons.lang3.text.StrSubstitutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.