Search in sources :

Example 1 with StringExpression

use of com.querydsl.core.types.dsl.StringExpression in project querydsl by querydsl.

the class GroupByMapTest method compile.

@Test
public void compile() {
    StringExpression str = Expressions.stringPath("str");
    GroupExpression<String, String> strGroup = new GOne<String>(str);
    GroupBy.sortedMap(strGroup, str, null);
    GroupBy.sortedMap(str, strGroup, null);
}
Also used : StringExpression(com.querydsl.core.types.dsl.StringExpression) Test(org.junit.Test)

Example 2 with StringExpression

use of com.querydsl.core.types.dsl.StringExpression in project querydsl by querydsl.

the class PathMetadataTest method test.

@SuppressWarnings("unchecked")
@Test
public void test() throws Exception {
    Field field = ConstantImpl.class.getDeclaredField("STRINGS");
    field.setAccessible(true);
    Map<String, StringExpression> cache = (Map) field.get(null);
    System.out.println(cache.size() + " entries in ConstantImpl string cache");
    // numbers
    assertTrue(cache.containsKey("0"));
    assertTrue(cache.containsKey("10"));
    // variables
    assertTrue(cache.containsKey("animal"));
    assertTrue(cache.containsKey("cat"));
    assertTrue(cache.containsKey("category"));
    assertTrue(cache.containsKey("simpleTypes"));
    // properties
    assertTrue(cache.containsKey("mate"));
}
Also used : Field(java.lang.reflect.Field) StringExpression(com.querydsl.core.types.dsl.StringExpression) Map(java.util.Map) Test(org.junit.Test)

Example 3 with StringExpression

use of com.querydsl.core.types.dsl.StringExpression in project querydsl by querydsl.

the class QueryProjectionTest method dto_case.

@Test
public void dto_case() throws SecurityException, NoSuchMethodException {
    NumberExpression<Long> longExpr = Expressions.numberPath(Long.class, "x");
    StringExpression stringExpr = Expressions.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("", "");
}
Also used : StringExpression(com.querydsl.core.types.dsl.StringExpression) Test(org.junit.Test)

Example 4 with StringExpression

use of com.querydsl.core.types.dsl.StringExpression in project querydsl by querydsl.

the class QueryProjectionTest method entity_case.

@Test
public void entity_case() {
    NumberExpression<Long> longExpr = Expressions.numberPath(Long.class, "x");
    StringExpression stringExpr = Expressions.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("", "");
}
Also used : StringExpression(com.querydsl.core.types.dsl.StringExpression) Test(org.junit.Test)

Example 5 with StringExpression

use of com.querydsl.core.types.dsl.StringExpression in project querydsl by querydsl.

the class TemplateTest method toDate.

@Test
public void toDate() {
    StringExpression str = Expressions.stringPath("str");
    assertEquals("to_date(str,'DD-MON-YYYY')", to_date(str, "DD-MON-YYYY").toString());
}
Also used : StringExpression(com.querydsl.core.types.dsl.StringExpression) Test(org.junit.Test)

Aggregations

StringExpression (com.querydsl.core.types.dsl.StringExpression)6 Test (org.junit.Test)6 Field (java.lang.reflect.Field)2 Expression (com.querydsl.core.types.Expression)1 BooleanExpression (com.querydsl.core.types.dsl.BooleanExpression)1 Method (java.lang.reflect.Method)1 Map (java.util.Map)1