Examples of StrSubstitutor


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

        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

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

        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

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

        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

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

        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

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

        .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

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

    String summary = getEventDescription();
    eventData.put("SUMMARY", summary);
    eventData.put("DESCRIPTION", summary);
   
    eventData.put("UID", getEventUID());
    StrSubstitutor sub = new StrSubstitutor(eventData);
   
    return sub.replace(template);
  }
View Full Code Here

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

        JirmPrecondition.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

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

        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

Examples of org.apache.logging.log4j.core.lookup.StrSubstitutor

            LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
            assertNotNull("No LoggerContext", ctx);
            assertNotNull("No ServletContext", ctx.getExternalContext());
            Configuration config = ctx.getConfiguration();
            assertNotNull("No Configuration", config);
            StrSubstitutor substitutor = config.getStrSubstitutor();
            assertNotNull("No Interpolator", substitutor);
            String value = substitutor.replace("${web:initParam.TestParam}");
            assertNotNull("No value for TestParam", value);
            assertEquals("Incorrect value for TestParam: " + value, "ParamValue", value);
            value = substitutor.replace("${web:attr.TestAttr}");
            assertNotNull("No value for TestAttr", value);
            assertEquals("Incorrect value for TestAttr: " + value, "AttrValue", value);
            value = substitutor.replace("${web:Name1}");
            assertNotNull("No value for Name1", value);
            assertEquals("Incorrect value for Name1: " + value, "Ben", value);
            value = substitutor.replace("${web:Name2}");
            assertNotNull("No value for Name2", value);
            assertEquals("Incorrect value for Name2: " + value, "Jerry", value);
        } catch (final IllegalStateException e) {
            fail("Failed to initialize Log4j properly." + e.getMessage());
        }
View Full Code Here

Examples of org.apache.logging.log4j.core.lookup.StrSubstitutor

            initializer.setLoggerContext();
            LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
            assertNotNull("No LoggerContext", ctx);
            Configuration config = ctx.getConfiguration();
            assertNotNull("No Configuration", config);
            StrSubstitutor substitutor = config.getStrSubstitutor();
            assertNotNull("No Interpolator", substitutor);
            String value = substitutor.replace("${web:initParam.TestParam}");
            assertNotNull("No value for TestParam", value);
            assertTrue("Incorrect value for TestParam: " + value, "ParamValue".equals(value));
            value = substitutor.replace("${web:attr.TestAttr}");
            assertNotNull("No value for TestAttr", value);
            assertTrue("Incorrect value for TestAttr: " + value, "AttrValue".equals(value));
            value = substitutor.replace("${web:Name1}");
            assertNotNull("No value for Name1", value);
            assertTrue("Incorrect value for Name1: " + value, "Ben".equals(value));
            value = substitutor.replace("${web:Name2}");
            assertNotNull("No value for Name2", value);
            assertTrue("Incorrect value for Name2: " + value, "Jerry".equals(value));
        } catch (final UnavailableException e) {
            fail("Failed to initialize Log4j properly." + e.getMessage());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.