Package org.apache.commons.lang.text

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


     * @return Activity body text.
     */
    public String resolveActivityBody(final ActivityDTO activity, final Context context)
    {
        // substitute variables
        StrSubstitutor transform = new StrSubstitutor(new StrLookup()
        {
            @Override
            public String lookup(final String variableName)
            {
                if ("ACTORNAME".equals(variableName))
                {
                    return activity.getActor().getDisplayName();
                }
                else
                {
                    return null;
                }
            }
        }, VARIABLE_START_MARKER, VARIABLE_END_MARKER, StrSubstitutor.DEFAULT_ESCAPE);
        String result = transform.replace(activity.getBaseObjectProperties().get("content"));

        //
        if (!result.isEmpty())
        {
            int startIndex = 0, lastSeenLinebreakInLeadingWhitespace = -1, endIndex = result.length();
View Full Code Here


     */
    @Override
    public String lookup(String var)
    {
        ConfigurationInterpolator interp = configuration.getInterpolator();
        StrSubstitutor subst = new StrSubstitutor(interp, prefixMatcher, suffixMatcher,
                StrSubstitutor.DEFAULT_ESCAPE);

        String result = subst.replace(var);

        try
        {
            Expression exp = engine.createExpression(result);
            result = (String) exp.evaluate(createContext());
View Full Code Here

     */
    public synchronized StrSubstitutor getSubstitutor()
    {
        if (substitutor == null)
        {
            substitutor = new StrSubstitutor(createInterpolator());
        }
        return substitutor;
    }
View Full Code Here

              String _put_1 = replacements.put("workspace", "build/classes");
              _builder.append(_put_1, "    ");
              _builder.newLineIfNotEmpty();
              _builder.append("\t");
              _builder.append("\t");
              StrSubstitutor _strSubstitutor = new StrSubstitutor(replacements);
              final StrSubstitutor sub = _strSubstitutor;
              _builder.newLineIfNotEmpty();
              _builder.append("\t");
              _builder.append("\t");
              _builder.append("file=\"");
              String _replace_1 = sub.replace(serviceFile);
              _builder.append(_replace_1, "    ");
              _builder.append("\"");
              _builder.newLineIfNotEmpty();
              _builder.append("\t");
              _builder.append("/>");
View Full Code Here

    }
   
    @Override
    public String getProperty(String key, Map<String, String> variables)
    {
      StrSubstitutor substitutor = new StrSubstitutor(variables);
      key = substitutor.replace(key);
      return getProperty(key);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.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.