Example usage for org.apache.commons.lang.text StrSubstitutor DEFAULT_ESCAPE

List of usage examples for org.apache.commons.lang.text StrSubstitutor DEFAULT_ESCAPE

Introduction

In this page you can find the example usage for org.apache.commons.lang.text StrSubstitutor DEFAULT_ESCAPE.

Prototype

char DEFAULT_ESCAPE

To view the source code for org.apache.commons.lang.text StrSubstitutor DEFAULT_ESCAPE.

Click Source Link

Document

Constant for the default escape character.

Usage

From source file:org.eurekastreams.server.action.execution.notification.notifier.NotificationMessageBuilderHelper.java

/**
 * Returns a variable-substituted version of the activity's body.
 * /*from  w  ww.  j  a  v a  2 s.  com*/
 * @param activity
 *            Activity.
 * @param context
 *            Velocity context.
 * @return Activity body text.
 */
public String resolveActivityBody(final ActivityDTO activity, final Context context) {
    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"));
    return result;
}