Class QTuple

All Implemented Interfaces:
Expression<Tuple>, FactoryExpression<Tuple>, Serializable

@Immutable public class QTuple extends FactoryExpressionBase<Tuple>
QTuple represents a projection of type Tuple

Usage example:

 
 List<Tuple> result = query.from(employee).select(Projections.tuple(employee.firstName, employee.lastName)).fetch();
 for (Tuple row : result) {
     System.out.println("firstName " + row.get(employee.firstName));
     System.out.println("lastName " + row.get(employee.lastName));
 }
 

Since Tuple projection is the default for multi column projections, the above is equivalent to this code

 
 List<Tuple> result = query.from(employee).select(employee.firstName, employee.lastName).fetch();
 for (Tuple row : result) {
     System.out.println("firstName " + row.get(employee.firstName));
     System.out.println("lastName " + row.get(employee.lastName));
 }
 
Author:
tiwe
See Also:
  • Constructor Details

    • QTuple

      protected QTuple(Expression<?>... args)
      Create a new QTuple instance
      Parameters:
      args -
    • QTuple

      protected QTuple(List<Expression<?>> args)
      Create a new QTuple instance
      Parameters:
      args -
    • QTuple

      protected QTuple(Expression<?>[]... args)
      Create a new QTuple instance
      Parameters:
      args -
  • Method Details

    • newInstance

      public Tuple newInstance(Object... a)
      Description copied from interface: FactoryExpression
      Create a projection with the given arguments
      Parameters:
      a - row arguments
      Returns:
      constructed value
    • accept

      public <R, C> R accept(Visitor<R,C> v, C context)
      Description copied from interface: Expression
      Accept the visitor with the given context
      Type Parameters:
      R - return type
      C - context type
      Parameters:
      v - visitor
      context - context of visit
      Returns:
      result of visit
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class FactoryExpressionBase<Tuple>
    • getArgs

      public @Unmodifiable List<Expression<?>> getArgs()
      Description copied from interface: FactoryExpression
      Get the invocation arguments
      Returns:
      argument expressions