Package com.mysema.codegen

Examples of com.mysema.codegen.Evaluator


    @SuppressWarnings("unchecked")
    @Test
    public void test() {
        DefaultEvaluatorFactory evaluatorFactory = new DefaultEvaluatorFactory(CollQueryTemplates.DEFAULT);
        QCat cat = QCat.cat;
        Evaluator projectionEvaluator = evaluatorFactory.create(metadata, Collections.singletonList(cat), cat.name);
        EvaluatorFunction transformer = new EvaluatorFunction(projectionEvaluator);

        Cat c = new Cat("Kitty");
        assertEquals("Kitty", transformer.apply(c));
    }
View Full Code Here


        for (int i = 0; i < orderBy.size(); i++) {
            orderByExpr[i] = (Expression) orderBy.get(i).getTarget();
            directions[i] = orderBy.get(i).getOrder() == Order.ASC;
        }
        Expression<?> expr = new ArrayConstructorExpression<Object>(Object[].class, orderByExpr);
        Evaluator orderEvaluator = evaluatorFactory.create(metadata, sources, expr);
        Collections.sort(list, new MultiComparator(orderEvaluator, directions));
    }
View Full Code Here

        if (projection instanceof Operation && Ops.aggOps.contains(((Operation)projection).getOperator())) {
            Operation<?> aggregation = (Operation<?>)projection;
            aggregator = aggregation.getOperator();
            projection = aggregation.getArg(0);
        }
        Evaluator projectionEvaluator = evaluatorFactory.create(metadata, sources, projection);
        EvaluatorFunction transformer = new EvaluatorFunction(projectionEvaluator);
        List target = new ArrayList();
        Iterators.addAll(target, Iterators.transform(list.iterator(), transformer));
        if (aggregator != null) {
            return ImmutableList.of(CollQueryFunctions.aggregate(target, projection, aggregator));
View Full Code Here

TOP

Related Classes of com.mysema.codegen.Evaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.