Package com.querydsl.core
Interface Tuple
public interface Tuple
Tuple defines an interface for generic query result projection
Usage example:
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
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAll Tuples should override equals and hashCode.<T> TGet a Tuple element by index<T> Tget(Expression<T> expr) Get a tuple element by expressioninthashCode()All Tuples should override equals and hashCode.intsize()Get the size of the TupleObject[]toArray()Get the content as an Object array
-
Method Details
-
get
Get a Tuple element by index- Type Parameters:
T- type of element- Parameters:
index- zero based indextype- type of element- Returns:
- element in array
-
get
Get a tuple element by expression- Type Parameters:
T- type of element- Parameters:
expr- expression key- Returns:
- result element that matches the expression
-
size
int size()Get the size of the Tuple- Returns:
- row element count
-
toArray
Object[] toArray()Get the content as an Object array- Returns:
- tuple in array form
-
equals
All Tuples should override equals and hashCode. For compatibility across different Tuple implementations, equality check should usejava.util.Arrays#equals(Object[], Object[])with#toArray()as parameters. -
hashCode
int hashCode()All Tuples should override equals and hashCode. For compatibility across different Tuple implementations, hashCode should usejava.util.Arrays#hashCode(Object[])with#toArray()as parameter.
-