Package com.querydsl.core.types
Class Projections
java.lang.Object
com.querydsl.core.types.Projections
Factory class for
FactoryExpression
instances- Author:
- tiwe
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 valuestatic <T> ArrayConstructorExpression<T>
array
(Class<T[]> type, Expression<T>... exprs) Create a typed array projection for the given type and expressionsstatic <T> QBean<T>
bean
(Path<? extends T> type, Expression<?>... exprs) Create a Bean populating projection for the given type and expressionsstatic <T> QBean<T>
bean
(Path<? extends T> type, Map<String, ? extends Expression<?>> bindings) Create a Bean populating projection for the given type and bindingsstatic <T> QBean<T>
bean
(Class<? extends T> type, Expression<?>... exprs) Create a Bean populating projection for the given type and expressionsstatic <T> QBean<T>
bean
(Class<? extends T> type, Map<String, ? extends Expression<?>> bindings) Create a Bean populating projection for the given type and bindingsstatic <T> ConstructorExpression<T>
constructor
(Class<? extends T> type, Expression<?>... exprs) Create a constructor invocation projection for the given type and expressionsstatic <T> ConstructorExpression<T>
constructor
(Class<? extends T> type, Class<?>[] paramTypes, Expression<?>... exprs) Create a constructor invocation projection for given type, parameter types and expressionsstatic <T> ConstructorExpression<T>
constructor
(Class<? extends T> type, Class<?>[] paramTypes, List<Expression<?>> exprs) Create a constructor invocation projection for given type, parameter types and expressionsstatic <T> QBean<T>
fields
(Path<? extends T> type, Expression<?>... exprs) Create a field access based Bean populating projection for the given type and expressionsstatic <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 bindingsstatic <T> QBean<T>
fields
(Class<? extends T> type, Expression<?>... exprs) Create a field access based Bean populating projection for the given type and expressionsstatic <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 bindingsstatic QList
list
(Expression<?>... args) Create a new List typed projection for the given expressionsstatic QList
list
(Expression<?>[]... args) Create a new List typed projection for the given expressionsstatic QList
list
(List<Expression<?>> args) Create a new List typed projection for the given expressionsstatic QMap
map
(Expression<?>... exprs) Create a Map typed projection for the given expressionsstatic QTuple
tuple
(Expression<?>... exprs) Create a Tuple typed projection for the given expressionsstatic QTuple
tuple
(Expression<?>[]... exprs) Create a Tuple typed projection for the given expressionsstatic QTuple
tuple
(List<Expression<?>> exprs) Create a Tuple typed projection for the given expressions
-
Method Details
-
array
Create a typed array projection for the given type and expressions- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
appending
public 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- Type Parameters:
T
- type of projection- Parameters:
base
- first argumentrest
- additional arguments- Returns:
- factory expression
-
bean
Create a Bean populating projection for the given type and expressionsExample
UserDTO dto = query.select( Projections.bean(UserDTO.class, user.firstName, user.lastName));
- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
bean
Create a Bean populating projection for the given type and expressions- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
bean
public 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- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionbindings
- property bindings- Returns:
- factory expression
-
bean
public 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- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionbindings
- property bindings- Returns:
- factory expression
-
constructor
public static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Expression<?>... exprs) Create a constructor invocation projection for the given type and expressionsExample
UserDTO dto = query.singleResult( Projections.constructor(UserDTO.class, user.firstName, user.lastName));
- Type Parameters:
T
- type projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
constructor
public 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- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionparamTypes
- constructor parameter typesexprs
- constructor parameters- Returns:
- factory expression
-
constructor
public static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Class<?>[] paramTypes, List<Expression<?>> exprs) Create a constructor invocation projection for given type, parameter types and expressions- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionparamTypes
- constructor parameter typesexprs
- constructor parameters- Returns:
- factory expression
-
fields
Create a field access based Bean populating projection for the given type and expressionsExample
UserDTO dto = query.singleResult( Projections.fields(UserDTO.class, user.firstName, user.lastName));
- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
fields
Create a field access based Bean populating projection for the given type and expressions- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionexprs
- arguments for the projection- Returns:
- factory expression
-
fields
public 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- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionbindings
- field bindings- Returns:
- factory expression
-
fields
public 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- Type Parameters:
T
- type of projection- Parameters:
type
- type of the projectionbindings
- field bindings- Returns:
- factory expression
-
list
Create a new List typed projection for the given expressions- Parameters:
args
- list elements- Returns:
- factory expression
-
list
Create a new List typed projection for the given expressions- Parameters:
args
- list elements- Returns:
- factory expression
-
list
Create a new List typed projection for the given expressions- Parameters:
args
- list elements- Returns:
- factory expression
-
map
Create a Map typed projection for the given expressionsExample
Map<Expression<?>, ?> map = query.select( Projections.map(user.firstName, user.lastName));
- Parameters:
exprs
- arguments for the projection- Returns:
- factory expression
-
tuple
Create a Tuple typed projection for the given expressions- Parameters:
exprs
- arguments for the projection- Returns:
- factory expression
-
tuple
Create a Tuple typed projection for the given expressions- Parameters:
exprs
- arguments for the projection- Returns:
- factory expression
-
tuple
Create a Tuple typed projection for the given expressions- Parameters:
exprs
- arguments for the projection- Returns:
- factory expression
-