public String process(String content) { Matcher matcher = Pattern.compile(ELEMENT_BOUNDARY).matcher(content); StringBuilder sb = new StringBuilder(); int startIndex, matchIndex; for (startIndex = 0; matcher.find(); startIndex = matcher.end()) { matchIndex = matcher.start(); String preMatch = content.substring(startIndex, matchIndex); if (!StringUtil.isBlank(preMatch)) sb.append(span(preMatch)); if (!StringUtil.isBlank(matcher.group(2))) sb.append(matcher.group()); } String postMatch = content.substring(startIndex, content.length()); if (!StringUtil.isBlank(postMatch)) sb.append(span(postMatch)); return sb.toString(); }
public OgnlResolution(String expression) { if (StringUtil.isBlank(expression)) throw new IllegalArgumentException("No expression to resolve"); this.expression = expression; }