public static BooleanExpression createLike(Expression left, String right, String escape) { if (escape != null && escape.length() != 1) { throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape); } int c = -1; if (escape != null) { c = 0xFFFF & escape.charAt(0); } return new LikeExpression(left, right, c); }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
/** */ public LikeExpression(Expression right, String like, int escape) { super(right); StringBuffer regexp = new StringBuffer(like.length() * 2); regexp.append("\\A"); // The beginning of the input for (int i = 0; i < like.length(); i++) { char c = like.charAt(i); if (escape == (0xFFFF & c) && shouldEscapeNext(like, i, c)) { i++; char t = like.charAt(i); regexp.append("\\x"); regexp.append(Integer.toHexString(0xFFFF & t)); } else { append(regexp, c); } } regexp.append("\\z"); // The end of the input likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL); }
/** */ public LikeExpression(Expression right, String like, int escape) { super(right); StringBuffer regexp = new StringBuffer(like.length() * 2); regexp.append("\\A"); // The beginning of the input for (int i = 0; i < like.length(); i++) { char c = like.charAt(i); if (escape == (0xFFFF & c) && shouldEscapeNext(like, i, c)) { i++; char t = like.charAt(i); regexp.append("\\x"); regexp.append(Integer.toHexString(0xFFFF & t)); } else { append(regexp, c); } } regexp.append("\\z"); // The end of the input likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL); }
/** */ public LikeExpression(Expression right, String like, int escape) { super(right); StringBuffer regexp = new StringBuffer(like.length() * 2); regexp.append("\\A"); // The beginning of the input for (int i = 0; i < like.length(); i++) { char c = like.charAt(i); if (escape == (0xFFFF & c) && shouldEscapeNext(like, i, c)) { i++; char t = like.charAt(i); regexp.append("\\x"); regexp.append(Integer.toHexString(0xFFFF & t)); } else { append(regexp, c); } } regexp.append("\\z"); // The end of the input likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL); }
/** */ public LikeExpression(Expression right, String like, int escape) { super(right); StringBuffer regexp = new StringBuffer(like.length() * 2); regexp.append("\\A"); // The beginning of the input for (int i = 0; i < like.length(); i++) { char c = like.charAt(i); if (escape == (0xFFFF & c) && shouldEscapeNext(like, i, c)) { i++; char t = like.charAt(i); regexp.append("\\x"); regexp.append(Integer.toHexString(0xFFFF & t)); } else { append(regexp, c); } } regexp.append("\\z"); // The end of the input likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL); }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
public static BooleanExpression createLike(Expression left, String right, String escape) { if (escape != null && escape.length() != 1) { throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape); } int c = -1; if (escape != null) { c = 0xFFFF & escape.charAt(0); } return new LikeExpression(left, right, c); }
public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); return object != null && object == Boolean.TRUE; } }
public static BooleanExpression createLike(Expression left, String right, String escape) { if (escape != null && escape.length() != 1) { throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape); } int c = -1; if (escape != null) { c = 0xFFFF & escape.charAt(0); } return new LikeExpression(left, right, c); }
public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); return object != null && object == Boolean.TRUE; } }
public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); return object != null && object == Boolean.TRUE; } }
public static BooleanExpression createLike(Expression left, String right, String escape) { if (escape != null && escape.length() != 1) { throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape); } int c = -1; if (escape != null) { c = 0xFFFF & escape.charAt(0); } return new LikeExpression(left, right, c); }
public static BooleanExpression createLike(Expression left, String right, String escape) { if (escape != null && escape.length() != 1) { throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape); } int c = -1; if (escape != null) { c = 0xFFFF & escape.charAt(0); } return new LikeExpression(left, right, c); }
public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); return object != null && object == Boolean.TRUE; } }
public boolean matches(MessageEvaluationContext message) throws JMSException { Object object = evaluate(message); return object != null && object == Boolean.TRUE; } }