HqlParserTest.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:hibernate-semantic-query 作者:
/**
 * Pass in a parse tree that has exactly one equality predicate with the right hand operand being the expected literal
 */
private void validateDateTimeLiteralInEqualityPredicate(HqlParser parser, DateTimeLiteralType expectedType) {
    Collection<ParseTree> predicates = XPath.findAll( parser.statement(), "//predicate", parser );
    assertEquals( 1, predicates.size() );

    EqualityPredicateContext predicate = (EqualityPredicateContext) predicates.iterator().next();
    // predicate[1] -> the literal
    assertTrue( predicate.expression( 1 ) instanceof LiteralExpressionContext );

    LiteralExpressionContext lec = (LiteralExpressionContext) predicate.expression( 1 );
    DateTimeLiteralType found = lec.literal().accept( new DateTimeLiteralCategorizingVisitor() );

    assertEquals( expectedType, found );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号