Changeset 1003
- Timestamp:
- 2008-12-30 09:47:51 (4 years ago)
- Location:
- trunk/universe/kauri-template/src/main/java/org/kauriproject/template/el
- Files:
-
- 1 edited
- 1 moved
-
ELFacade.java (modified) (3 diffs)
-
LiteralExpression.java (moved) (moved from trunk/universe/kauri-template/src/main/java/org/kauriproject/template/el/LitteralExpression.java) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/universe/kauri-template/src/main/java/org/kauriproject/template/el/ELFacade.java
r999 r1003 56 56 int brace = expression.indexOf('{', start); 57 57 if (start < 0 || brace < 0) { 58 // not a valid expression: parse as lit teral59 cex.add(new Lit teralExpression(sanitize(expression), expectedType));58 // not a valid expression: parse as literal 59 cex.add(new LiteralExpression(sanitize(expression), expectedType)); 60 60 } else { 61 61 String id = null; 62 62 if (start > 0) { 63 cex.add(new Lit teralExpression(sanitize(expression.substring(0, start)), expectedType));63 cex.add(new LiteralExpression(sanitize(expression.substring(0, start)), expectedType)); 64 64 } 65 65 id = expression.substring(start + 1, brace); 66 66 int end = getEndPosition(expression, brace + 1); 67 67 if (id.length() > Expression.ID_MAX_LENGTH || id.contains(" ") || end < 0) { 68 // not a valid expression, parse start as lit teral69 cex.add(new Lit teralExpression(expression.substring(start, start + 1), expectedType));68 // not a valid expression, parse start as literal 69 cex.add(new LiteralExpression(expression.substring(start, start + 1), expectedType)); 70 70 // try to parse rest of the expression 71 71 parseExpression(expression.substring(start + 1), expectedType, cex); … … 81 81 } else { 82 82 log.warn("expression type '" + id + "' not supported"); 83 cex.add(new Lit teralExpression(sanitize(expression.substring(start, end + 1)),83 cex.add(new LiteralExpression(sanitize(expression.substring(start, end + 1)), 84 84 expectedType)); 85 85 } … … 130 130 * Remove escape characters. 131 131 */ 132 private String sanitize(String lit teral) {133 return lit teral.replaceAll("\\\\([$#])", "$1");132 private String sanitize(String literal) { 133 return literal.replaceAll("\\\\([$#])", "$1"); 134 134 } 135 135 -
trunk/universe/kauri-template/src/main/java/org/kauriproject/template/el/LiteralExpression.java
r1001 r1003 19 19 20 20 /** 21 * Implementation of a lit teral expression.21 * Implementation of a literal expression. 22 22 */ 23 public class Lit teralExpression implements Expression {23 public class LiteralExpression implements Expression { 24 24 25 25 private Object expression; 26 26 27 public Lit teralExpression(String expression, Class<?> expectedType) {27 public LiteralExpression(String expression, Class<?> expectedType) { 28 28 if (expectedType.equals(Boolean.class)) { 29 29 this.expression = Boolean.parseBoolean(expression);
Note: See TracChangeset
for help on using the changeset viewer.