1 16 package org.apache.cocoon.components.variables; 17 18 import org.apache.cocoon.sitemap.PatternException; 19 20 27 public class NOPVariableResolver 28 implements VariableResolver { 29 30 protected String expression; 31 32 public NOPVariableResolver(String expression) { 33 this.expression = this.unescape(expression); 34 } 35 36 43 protected String unescape(String expression) { 44 if (expression == null || expression.indexOf("\\{") == -1) { 46 return expression; 47 } 48 49 StringBuffer buf = new StringBuffer (); 50 for (int i = 0; i < expression.length(); i++) { 51 char ch = expression.charAt(i); 52 if (ch != '\\' || i >= (expression.length() - 1) || expression.charAt(i+1) != '{') { 53 buf.append(ch); 54 } 55 } 56 57 return buf.toString(); 58 } 59 60 63 public String resolve() throws PatternException { 64 return this.expression; 65 } 66 67 } 68 | Popular Tags |