use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method containsExp.
/**
* @since 4.0
* @see ExpressionFactory#containsExp(String, String)
*/
static Expression containsExp(Expression exp, String value) {
ASTLike like = likeExpInternal(exp, value, (char) 0);
LikeExpressionHelper.toContains(like);
return like;
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method endsWithExp.
/**
* @since 4.0
* @see ExpressionFactory#endsWithExp(String, String)
*/
static Expression endsWithExp(Expression exp, String value) {
ASTLike like = likeExpInternal(exp, value, (char) 0);
LikeExpressionHelper.toEndsWith(like);
return like;
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method containsExp.
/**
* @return An expression for a database "LIKE" query with the value
* converted to a pattern matching anywhere in the String.
* @since 4.0
*/
public static Expression containsExp(String pathSpec, String value) {
ASTLike like = likeExpInternal(pathSpec, value, (char) 0);
LikeExpressionHelper.toContains(like);
return like;
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_OneChar.
@Test
public void testEscape_OneChar() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "ab_c");
LikeExpressionHelper.escape(node);
assertEquals("ab!_c", node.getOperand(1));
assertEquals('!', node.getEscapeChar());
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_NoEscapeChars.
@Test
public void testEscape_NoEscapeChars() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "abc");
LikeExpressionHelper.escape(node);
assertEquals("abc", node.getOperand(1));
assertEquals(0, node.getEscapeChar());
}
Aggregations