use of com.querydsl.core.types.QTuple in project querydsl by querydsl.
the class RelationalPathTest method in_tuple.
@Test
public void in_tuple() throws ClassNotFoundException, IOException {
// (survey.id, survey.name)
QSurvey survey = QSurvey.survey;
QTuple tuple = Projections.tuple(survey.id, survey.name);
serialize(tuple);
serialize(tuple.newInstance(1, "a"));
}
use of com.querydsl.core.types.QTuple in project querydsl by querydsl.
the class NumberConversionsTest method name.
@Test
public void name() {
EnumPath<Color> color = Expressions.enumPath(Color.class, "path");
QTuple qTuple = Projections.tuple(color);
NumberConversions<Tuple> conversions = new NumberConversions<Tuple>(qTuple);
assertEquals(Color.BLUE, conversions.newInstance("BLUE").get(color));
}
use of com.querydsl.core.types.QTuple in project querydsl by querydsl.
the class NumberConversionsTest method ordinal.
@Test
public void ordinal() {
EnumPath<Color> color = Expressions.enumPath(Color.class, "path");
QTuple qTuple = Projections.tuple(color);
NumberConversions<Tuple> conversions = new NumberConversions<Tuple>(qTuple);
assertEquals(Color.RED, conversions.newInstance(2).get(color));
}
use of com.querydsl.core.types.QTuple 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.QTuple in project querydsl by querydsl.
the class NumberConversionsTest method number_conversion.
@Test
public void 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);
Tuple tuple = conversions.newInstance("a", 3L);
assertEquals("a", tuple.get(strPath));
assertEquals(Integer.valueOf(3), tuple.get(intPath));
}
Aggregations