HibernateQueryTranslator extends
        AbstractHibernateQueryTranslator<Criterion, Orders, Projection> implements QueryTranslator<Criterion, Orders, Projection> { @Override public <T, R> Projection translateProjection(Query<T, R> query) { if (query.getReturnFields().size() > 0) { ProjectionList projectionList = Projections.projectionList(); for (String returnField : query.getReturnFields()) { projectionList.add(Projections.property(returnField)); } return projectionList; } else { return null; } } HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker,
            ContainsExpressionHandler<Criterion> containsExpressionHandler);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver); @Override Criterion eq(String fieldName, Object value); @Override Criterion ne(String fieldName, Object value); @Override Criterion lt(String fieldName, Object value); @Override Criterion lte(String fieldName, Object value); @Override Criterion gt(String fieldName, Object value); @Override Criterion gte(String fieldName, Object value); @Override Criterion between(String fieldName, Object from, Object to); @Override Criterion in(String fieldName, Object[] values); @Override Criterion notIn(String fieldName, Object[] values); @Override Criterion isNull(String fieldName); @Override Criterion notNull(String fieldName); @Override Criterion isEmpty(String fieldName); @Override Criterion notEmpty(String fieldName); @Override Criterion within(
            String xFieldName, String yFieldName, Box<N> box); @Override Criterion and(Criterion... subqueries); @Override Criterion or(Criterion... subqueries); @Override Orders order(String fieldName, Ordering.Order o); @Override Orders order(Orders... orders); @Override Projection translateProjection(Query<T, R> query);  }
@Test public void translateProjection_null() { assertNull(translator.translateProjection(QueryBuilder.builderFor(String.class).build())); }
@Test public void translateProjection_some() { ProjectionList expected = Projections.projectionList() .add(Projections.property("a")).add(Projections.property("b")) .add(Projections.property("c")); Projection actual = translator.translateProjection(QueryBuilder.builderFor( String.class, String.class, "a", "b", "c").build()); assertArrayEquals(expected.getAliases(), actual.getAliases()); }