public final class Projections extends Object
FactoryExpression
instancesModifier and Type | Method and Description |
---|---|
static <T> com.querydsl.core.types.AppendingFactoryExpression<T> |
appending(Expression<T> base,
Expression<?>... rest)
Create an appending factory expression which serializes all the arguments but the uses
the base value as the return value
|
static <T> ArrayConstructorExpression<T> |
array(Class<T[]> type,
Expression<T>... exprs)
Create a typed array projection for the given type and expressions
|
static <T> QBean<T> |
bean(Class<? extends T> type,
Expression<?>... exprs)
Create a Bean populating projection for the given type and expressions
|
static <T> QBean<T> |
bean(Class<? extends T> type,
Map<String,? extends Expression<?>> bindings)
Create a Bean populating projection for the given type and bindings
|
static <T> QBean<T> |
bean(Path<? extends T> type,
Expression<?>... exprs)
Create a Bean populating projection for the given type and expressions
|
static <T> QBean<T> |
bean(Path<? extends T> type,
Map<String,? extends Expression<?>> bindings)
Create a Bean populating projection for the given type and bindings
|
static <T> ConstructorExpression<T> |
constructor(Class<? extends T> type,
Class<?>[] paramTypes,
Expression<?>... exprs)
Create a constructor invocation projection for given type, parameter types and expressions
|
static <T> ConstructorExpression<T> |
constructor(Class<? extends T> type,
Class<?>[] paramTypes,
com.google.common.collect.ImmutableList<Expression<?>> exprs)
Create a constructor invocation projection for given type, parameter types and expressions
|
static <T> ConstructorExpression<T> |
constructor(Class<? extends T> type,
Expression<?>... exprs)
Create a constructor invocation projection for the given type and expressions
|
static <T> QBean<T> |
fields(Class<? extends T> type,
Expression<?>... exprs)
Create a field access based Bean populating projection for the given type and expressions
|
static <T> QBean<T> |
fields(Class<? extends T> type,
Map<String,? extends Expression<?>> bindings)
Create a field access based Bean populating projection for the given type and bindings
|
static <T> QBean<T> |
fields(Path<? extends T> type,
Expression<?>... exprs)
Create a field access based Bean populating projection for the given type and expressions
|
static <T> QBean<T> |
fields(Path<? extends T> type,
Map<String,? extends Expression<?>> bindings)
Create a field access based Bean populating projection for the given type and bindings
|
static QList |
list(Expression<?>... args)
Create a new List typed projection for the given expressions
|
static QList |
list(Expression<?>[]... args)
Create a new List typed projection for the given expressions
|
static QList |
list(com.google.common.collect.ImmutableList<Expression<?>> args)
Create a new List typed projection for the given expressions
|
static QMap |
map(Expression<?>... exprs)
Create a Map typed projection for the given expressions
|
static QTuple |
tuple(Expression<?>... exprs)
Create a Tuple typed projection for the given expressions
|
static QTuple |
tuple(Expression<?>[]... exprs)
Create a Tuple typed projection for the given expressions
|
static QTuple |
tuple(com.google.common.collect.ImmutableList<Expression<?>> exprs)
Create a Tuple typed projection for the given expressions
|
public static <T> ArrayConstructorExpression<T> array(Class<T[]> type, Expression<T>... exprs)
T
- type of projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> com.querydsl.core.types.AppendingFactoryExpression<T> appending(Expression<T> base, Expression<?>... rest)
T
- type of projectionbase
- first argumentrest
- additional argumentspublic static <T> QBean<T> bean(Class<? extends T> type, Expression<?>... exprs)
Example
UserDTO dto = query.select( Projections.bean(UserDTO.class, user.firstName, user.lastName));
T
- type of projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> QBean<T> bean(Path<? extends T> type, Expression<?>... exprs)
T
- type of projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> QBean<T> bean(Path<? extends T> type, Map<String,? extends Expression<?>> bindings)
T
- type of projectiontype
- type of the projectionbindings
- property bindingspublic static <T> QBean<T> bean(Class<? extends T> type, Map<String,? extends Expression<?>> bindings)
T
- type of projectiontype
- type of the projectionbindings
- property bindingspublic static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Expression<?>... exprs)
Example
UserDTO dto = query.singleResult( Projections.constructor(UserDTO.class, user.firstName, user.lastName));
T
- type projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Class<?>[] paramTypes, Expression<?>... exprs)
T
- type of projectiontype
- type of the projectionparamTypes
- constructor parameter typesexprs
- constructor parameterspublic static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Class<?>[] paramTypes, com.google.common.collect.ImmutableList<Expression<?>> exprs)
T
- type of projectiontype
- type of the projectionparamTypes
- constructor parameter typesexprs
- constructor parameterspublic static <T> QBean<T> fields(Class<? extends T> type, Expression<?>... exprs)
Example
UserDTO dto = query.singleResult( Projections.fields(UserDTO.class, user.firstName, user.lastName));
T
- type of projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> QBean<T> fields(Path<? extends T> type, Expression<?>... exprs)
T
- type of projectiontype
- type of the projectionexprs
- arguments for the projectionpublic static <T> QBean<T> fields(Path<? extends T> type, Map<String,? extends Expression<?>> bindings)
T
- type of projectiontype
- type of the projectionbindings
- field bindingspublic static <T> QBean<T> fields(Class<? extends T> type, Map<String,? extends Expression<?>> bindings)
T
- type of projectiontype
- type of the projectionbindings
- field bindingspublic static QList list(Expression<?>... args)
args
- list elementspublic static QList list(com.google.common.collect.ImmutableList<Expression<?>> args)
args
- list elementspublic static QList list(Expression<?>[]... args)
args
- list elementspublic static QMap map(Expression<?>... exprs)
Example
Map<Expression<?>, ?> map = query.select(
Projections.map(user.firstName, user.lastName));
exprs
- arguments for the projectionpublic static QTuple tuple(Expression<?>... exprs)
exprs
- arguments for the projectionpublic static QTuple tuple(com.google.common.collect.ImmutableList<Expression<?>> exprs)
exprs
- arguments for the projectionpublic static QTuple tuple(Expression<?>[]... exprs)
exprs
- arguments for the projectionCopyright © 2007–2016 Querydsl. All rights reserved.