コード例 #1
0
  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();
  }
コード例 #2
0
  public OgnlResolution(String expression) {
    if (StringUtil.isBlank(expression))
      throw new IllegalArgumentException("No expression to resolve");

    this.expression = expression;
  }