Package org.apache.openjpa.kernel

Examples of org.apache.openjpa.kernel.ResultShape


        Class<?> type = s.getJavaType();
        if (type == null)
            type = Object.class;
        if (s.isCompoundSelection()) {
            CompoundSelection<?> cs = (CompoundSelection<?>)s;
            result = new ResultShape(s.getJavaType(), CompoundSelections.getFillStrategy(cs));
            List<Selection<?>> terms = cs.getCompoundSelectionItems();
            for (Selection<?> term : terms) {
                result.nest(getShape(q, result, term));
            }
        } else {
            if (parent.getType().isArray() && q.isMultiselect()) {
                Class<?> componentType = parent.getType().getComponentType();
                if (componentType == Tuple.class) {
                    result = new ResultShape(componentType,
                         new FillStrategy.Factory(new TupleFactory(s), TupleImpl.PUT), false);
                } else {
                    result = new ResultShape(componentType, new FillStrategy.Assign(), true);
                }
            } else {
                result = new ResultShape(type, new FillStrategy.Assign(), true);
            }
        }
        return result;
    }
View Full Code Here


    private ResultShape<?> evalResultShape(CriteriaQueryImpl<?> q) {
        List<Selection<?>> selections = q.getSelectionList();
        Class<?> resultClass = q.getResultType();
        ResultShape<?> result = null;
        if (q.isMultiselect()) {
           result = new ResultShape(resultClass, CompoundSelections.getFillStrategy(q.getSelection()));
           for (Selection<?> term : selections) {
               result.nest(getShape(q, result, term));
           }
        } else { // not multiselect
            FillStrategy<?> strategy = new FillStrategy.Assign();
            if (Tuple.class.isAssignableFrom(resultClass)) {
                TupleFactory factory = new TupleFactory(selections.toArray(new TupleElement[selections.size()]));
                strategy = new FillStrategy.Factory<Tuple>(factory,  TupleImpl.PUT);
            }
            result = new ResultShape(resultClass, strategy);
            if (q.getSelectionList() == null) {
                return result;
            }
            if (q.getSelectionList().size() == 1) {
                result = getShape(q, result, q.getSelectionList().get(0));
View Full Code Here

TOP

Related Classes of org.apache.openjpa.kernel.ResultShape

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.