use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.
the class NumberConversionsTest method safe_number_conversion.
@Test
public void safe_number_conversion() {
StringPath strPath = Expressions.stringPath("strPath");
NumberPath<Integer> intPath = Expressions.numberPath(Integer.class, "intPath");
QTuple qTuple = Projections.tuple(strPath, intPath);
NumberConversions<Tuple> conversions = new NumberConversions<Tuple>(qTuple);
assertNotNull(conversions.newInstance(1, 2));
}
use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.
the class DeepPopulationTest method deep_population_via_qBean.
@Test
public void deep_population_via_qBean() {
StringPath name = Expressions.stringPath("name");
StringPath id = Expressions.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");
assertEquals("nameX", entity1.getEntity2().getName());
assertEquals("idX", entity1.getEntity2().getId());
}
use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.
the class DeepPopulationTest method deep_population_via_qTuple.
@Test
public void deep_population_via_qTuple() {
StringPath name = Expressions.stringPath("name");
StringPath id = Expressions.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());
}
use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.
the class PhraseElementTest method test.
@Test
public void test() {
StringPath title = Expressions.stringPath("title");
LuceneSerializer serializer = new LuceneSerializer(false, false);
QueryMetadata metadata = new DefaultQueryMetadata();
assertEquals("title:Hello World", serializer.toQuery(title.eq("Hello World"), metadata).toString());
assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq(new PhraseElement("Hello World")), metadata).toString());
}
use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.
the class TermElementTest method test.
@Test
public void test() {
StringPath title = Expressions.stringPath("title");
LuceneSerializer serializer = new LuceneSerializer(false, true);
QueryMetadata metadata = new DefaultQueryMetadata();
assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq("Hello World"), metadata).toString());
assertEquals("title:Hello World", serializer.toQuery(title.eq(new TermElement("Hello World")), metadata).toString());
}
Aggregations