Package com.mysema.query

Examples of com.mysema.query.Tuple


        StringPath name = new StringPath("name");
        StringPath id = new StringPath("id");
        QBean<Entity2> entity2Bean = new QBean<Entity2>(Entity2.class, name, id);
        QTuple tupleExpr = new QTuple(entity2Bean);

        Tuple tuple = FactoryExpressionUtils.wrap(tupleExpr).newInstance("nameX","idX");
        assertEquals("nameX", tuple.get(entity2Bean).getName());
        assertEquals("idX", tuple.get(entity2Bean).getId());
    }
View Full Code Here


    private QTuple tupleExpression = new QTuple(first, second, third);

    @Test
    public void NewInstanceObjectArray() {
        Tuple tuple = tupleExpression.newInstance("1", 42, true);
        assertEquals(3, tuple.size());
        assertEquals("1", tuple.get(0, String.class));
        assertEquals(Integer.valueOf(42), tuple.get(1, Integer.class));
        assertEquals(Boolean.TRUE, tuple.get(2, Boolean.class));
        assertEquals("1", tuple.get(first));
        assertEquals(Integer.valueOf(42), tuple.get(second));
        assertEquals(Boolean.TRUE, tuple.get(third));

    }
View Full Code Here

        Object commentId = null;
        Map<Integer, String> comments = null;
        List<Map<Integer, String>> expected = new LinkedList<Map<Integer, String>>();
        for (Iterator<Tuple> iterator = MAP2_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();

            if (comments == null || !(commentId == array[0] || commentId != null && commentId.equals(array[0]))) {
                comments = new LinkedHashMap<Integer,String>();
                expected.add(comments);
            }
View Full Code Here

       
        Object postId = null;
        Map<Integer, Map<Integer, String>> posts = null;
        List<Map<Integer, Map<Integer, String>>> expected = new LinkedList<Map<Integer, Map<Integer, String>>>();
        for (Iterator<Tuple> iterator = MAP3_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();
           
            if (posts == null || !(postId == array[0] || postId != null && postId.equals(array[0]))) {
                posts = new LinkedHashMap<Integer, Map<Integer,String>>();
                expected.add(posts);
            }
View Full Code Here

       
        Object commentId = null;
        Map<Map<Integer, String>, String> comments = null;
        List<Map<Map<Integer, String>, String>> expected = new LinkedList<Map<Map<Integer, String>, String>>();
        for (Iterator<Tuple> iterator = MAP4_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();
            if (comments == null || !(commentId == array[0] || commentId != null && commentId.equals(array[0]))) {
                comments = new LinkedHashMap<Map<Integer, String>, String>();
                expected.add(comments);
            }
View Full Code Here

    @Test
    public void Alias() {
        Expression<?> expr = str1.as("s");
        QTuple qTuple = new QTuple(expr);
        Tuple tuple = qTuple.newInstance("arg");
        assertEquals("arg", tuple.get(expr));
        assertEquals("arg", tuple.get(new StringPath("s")));
    }
View Full Code Here

        Map<Integer, Map<Integer, Map<Integer, String>>> actual = MAP3_RESULTS.transform(
            groupBy(postId).as(map(postId, map(commentId, commentText))));
       
        Map<Integer, Map<Integer, Map<Integer, String>>> expected = new LinkedHashMap<Integer, Map<Integer, Map<Integer, String>>>();
        for (Iterator<Tuple> iterator = MAP3_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();
           
            Map<Integer, Map<Integer, String>> posts = expected.get(array[0]);
            if (posts == null) {
                posts = new LinkedHashMap<Integer, Map<Integer,String>>();
                expected.put((Integer) array[0], posts);
View Full Code Here

        Map<Integer, Map<Map<Integer, String>, String>> actual = MAP4_RESULTS.transform(
            groupBy(postId).as(map(map(postId, commentText), postName)));
       
        Map<Integer, Map<Map<Integer, String>, String>> expected = new LinkedHashMap<Integer, Map<Map<Integer, String>, String>>();
        for (Iterator<Tuple> iterator = MAP4_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();
            Map<Map<Integer, String>, String> comments = expected.get(array[0]);
            if (comments == null) {
                comments = new LinkedHashMap<Map<Integer, String>, String>();
                expected.put((Integer) array[0], comments);
View Full Code Here

    public void Number_Conversion() {
        StringPath strPath = new StringPath("strPath");
        NumberPath<Integer> intPath = new NumberPath<Integer>(Integer.class, "intPath");
        QTuple qTuple = new QTuple(strPath, intPath);
        NumberConversions<Tuple> conversions = new NumberConversions<Tuple>(qTuple);
        Tuple tuple = conversions.newInstance("a", Long.valueOf(3));
        assertEquals("a", tuple.get(strPath));
        assertEquals(Integer.valueOf(3), tuple.get(intPath));
    }
View Full Code Here

       
        Object postId = null;
        Map<Integer, Map<Integer, String>> posts = null;
        List<Map<Integer, Map<Integer, String>>> expected = new LinkedList<Map<Integer, Map<Integer, String>>>();
        for (Iterator<Tuple> iterator = MAP3_RESULTS.iterate(); iterator.hasNext();) {
            Tuple tuple = iterator.next();
            Object[] array = tuple.toArray();
           
            if (posts == null || !(postId == array[0] || postId != null && postId.equals(array[0]))) {
                posts = new LinkedHashMap<Integer, Map<Integer,String>>();
                expected.add(posts);
            }
View Full Code Here

TOP

Related Classes of com.mysema.query.Tuple

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.