1 19 20 package org.apache.cayenne.exp.parser; 21 22 import org.apache.cayenne.exp.Expression; 23 import org.apache.cayenne.util.ConversionUtil; 24 25 30 public class ASTLikeIgnoreCase extends PatternMatchNode { 31 ASTLikeIgnoreCase(int id) { 32 super(id, true); 33 } 34 35 public ASTLikeIgnoreCase() { 36 super(ExpressionParserTreeConstants.JJTLIKEIGNORECASE, true); 37 } 38 39 public ASTLikeIgnoreCase(ASTPath path, Object pattern) { 40 super(ExpressionParserTreeConstants.JJTLIKEIGNORECASE, true); 41 jjtAddChild(path, 0); 42 jjtAddChild(wrapChild(pattern), 1); 43 } 44 45 protected Object evaluateNode(Object o) throws Exception { 46 int len = jjtGetNumChildren(); 47 if (len != 2) { 48 return Boolean.FALSE; 49 } 50 51 String s1 = ConversionUtil.toString(evaluateChild(0, o)); 52 if (s1 == null) { 53 return Boolean.FALSE; 54 } 55 56 return matchPattern(s1) ? Boolean.TRUE : Boolean.FALSE; 57 } 58 59 62 public Expression shallowCopy() { 63 return new ASTLikeIgnoreCase(id); 64 } 65 66 protected String getExpressionOperator(int index) { 67 return "likeIgnoreCase"; 68 } 69 70 public int getType() { 71 return Expression.LIKE_IGNORE_CASE; 72 } 73 } 74 | Popular Tags |