Query { public Query(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; ObjectBuilder select = queryBuilder.getSelect(); if (select != null) { selectEvaluator = new SelectEvaluator(queryBuilder, select); } joinBuilder = queryBuilder.getJoin(); joinPredicate = getJoin(); wherePredicate = getWhere(); } Query(QueryBuilder queryBuilder); static Query create(String queryString); static T execute(String queryString, Collection<?> items); static T execute(String queryString, Map<String, Object> context); T execute(Collection<?> items); T execute(Collection<?> items, String as); T execute(final Map<String, Object> context); String toString(); String getDefaultSelectObject(); void setDefaultSelectObject(String defaultFromObject); void setExecutor(Executor executor);  }
@Test public void testQuery() throws Exception { List<User> persons = getPersons(); Query query = new QueryBuilder() .as("p") .orderby("income") .max(3) .where(eq(property("division"), "Sales")) .select(newObject() .set("name", "firstName + ' ' + lastName") .set("income", "income")).build(); Collection<Map> result = query.execute(persons); assertEquals(3, result.size()); }