Package com.mysema.query.types.path

Examples of com.mysema.query.types.path.StringPath


        assertToString("substring(cat.name,1,locate(?1,cat.name)-1)", substr);
    }
   
    @Test
    public void IndexOf2() {
        StringPath str = QCat.cat.name;
        assertToString("substring(cat.name,1,locate(?1,cat.name)-1)", str.substring(0, str.indexOf("x")));
    }
View Full Code Here


        testQuery(rating.eq("good"), "rating:good", 1);
    }

    @Test
    public void Eq_with_deep_path() throws Exception{
        StringPath deepPath = entityPath.get("property1", Object.class).getString("property2");
        testQuery(deepPath.eq("good"), "property1.property2:good", 0);
    }
View Full Code Here

        assertEquals("getElements()", functionCall.getTemplate().toString());
    }
   
    @Test
    public void TwoArgs() {
        StringPath str = new StringPath("str");
        RelationalFunctionCall<String> functionCall = RelationalFunctionCall.create(String.class, "getElements", "a", str);
        assertEquals("getElements({0}, {1})", functionCall.getTemplate().toString());
        assertEquals("a", functionCall.getArg(0));
        assertEquals(str, functionCall.getArg(1));       
    }
View Full Code Here

        final StringPath token;
    
        public TokenizeFunction(String alias, String... tokens) {
           super(String.class, "tokenize", serializeCollection(tokens));
           this.alias = new PathBuilder<String>(String.class, alias);
           this.token = new StringPath(this.alias, "token");       
       }
View Full Code Here

    }

    @Test
    public void Entity_Case() {
        NumberExpression<Long> longExpr = new NumberPath<Long>(Long.class, "x");
        StringExpression stringExpr = new StringPath("x");

        QQueryProjectionTest_EntityWithProjection.create(longExpr).newInstance(0l);
        QQueryProjectionTest_EntityWithProjection.create(stringExpr).newInstance("");
        QQueryProjectionTest_EntityWithProjection.create(longExpr, stringExpr).newInstance(0l,"");
        QQueryProjectionTest_EntityWithProjection.create(stringExpr,stringExpr).newInstance("","");
View Full Code Here

    }

    @Test
    public void Dto_Case() throws SecurityException, NoSuchMethodException{
        NumberExpression<Long> longExpr = new NumberPath<Long>(Long.class, "x");
        StringExpression stringExpr = new StringPath("x");

        new QQueryProjectionTest_DTOWithProjection(longExpr).newInstance(0l);
        new QQueryProjectionTest_DTOWithProjection(stringExpr).newInstance("");
        new QQueryProjectionTest_DTOWithProjection(longExpr, stringExpr).newInstance(0l,"");
        new QQueryProjectionTest_DTOWithProjection(stringExpr, stringExpr).newInstance("","");
View Full Code Here

    }

    @Test
    public void Deep_Population_Via_QBean() {
        StringPath name = new StringPath("name");
        StringPath id = new StringPath("id");
        QBean<Entity2> entity2Bean = new QBean<Entity2>(Entity2.class, name, id);
        QBean<Entity1> entity1Bean = new QBean<Entity1>(Entity1.class,
                Collections.singletonMap("entity2", entity2Bean));

        Entity1 entity1 = FactoryExpressionUtils.wrap(entity1Bean).newInstance("nameX","idX");
View Full Code Here

        assertEquals("idX", entity1.getEntity2().getId());
    }

    @Test
    public void Deep_Population_Via_QTuple() {
        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());
View Full Code Here

        assertEquals(".*", regex(ConstantImpl.create("%")));
        assertEquals("^abc.*", regex(ConstantImpl.create("abc%")));
        assertEquals(".*abc$", regex(ConstantImpl.create("%abc")));
        assertEquals("^.$",  regex(ConstantImpl.create("_")));
       
        StringPath path = new StringPath("path");
        assertEquals("path + .*", regex(path.append("%")));
        assertEquals(".* + path", regex(path.prepend("%")));
        assertEquals("path + .", regex(path.append("_")));
        assertEquals(". + path", regex(path.prepend("_")));              
    }
View Full Code Here

   
    @Test
    @Ignore
    public void LikeToRegexSpeed() {
        // 4570
        StringPath path = new StringPath("path");
        final int iterations = 1000000;
        long start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            regex(ConstantImpl.create("%"));
            regex(ConstantImpl.create("abc%"));
            regex(ConstantImpl.create("%abc"));
            regex(ConstantImpl.create("_"));
            regex(path.append("%"));
            regex(path.prepend("%"));
            regex(path.append("_"));
            regex(path.prepend("_"));   
        }
        long duration = System.currentTimeMillis() - start;
        System.err.println(duration);
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.types.path.StringPath

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.