Package com.querydsl.core.types
Class MappingProjection<T>
java.lang.Object
com.querydsl.core.types.ExpressionBase<T>
com.querydsl.core.types.FactoryExpressionBase<T>
com.querydsl.core.types.MappingProjection<T>
- Type Parameters:
T- expression type
- All Implemented Interfaces:
Expression<T>,FactoryExpression<T>,Serializable
Projection template that allows implementing arbitrary mapping of rows to result objects.
Example
MappingProjection<Pair<String, String>> mapping = new MappingProjection<Pair<String, String>>(Pair.class, str1, str2) {
@Override
protected Pair<String, String> map(Tuple row) {
return Pair.of(row.get(str1), row.get(str2));
}
};
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMappingProjection(Class<? super T> type, Expression<?>... args) Create a new MappingProjection instanceMappingProjection(Class<? super T> type, Expression<?>[]... args) Create a new MappingProjection instance -
Method Summary
Modifier and TypeMethodDescription<R,C> R Accept the visitor with the given contextList<Expression<?>>getArgs()Get the invocation argumentsprotected abstract TCreates a result object from the given row.newInstance(Object... values) Create a projection with the given argumentsMethods inherited from class com.querydsl.core.types.FactoryExpressionBase
equals, skipNullsMethods inherited from class com.querydsl.core.types.ExpressionBase
getType, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.querydsl.core.types.Expression
getType
-
Constructor Details
-
MappingProjection
Create a new MappingProjection instance- Parameters:
type-args-
-
MappingProjection
Create a new MappingProjection instance- Parameters:
type-args-
-
-
Method Details
-
newInstance
Description copied from interface:FactoryExpressionCreate a projection with the given arguments- Parameters:
values- row arguments- Returns:
- constructed value
-
map
Creates a result object from the given row.- Parameters:
row- The row to map- Returns:
- The result object
-
getArgs
Description copied from interface:FactoryExpressionGet the invocation arguments- Returns:
- argument expressions
-
accept
Description copied from interface:ExpressionAccept the visitor with the given context- Type Parameters:
R- return typeC- context type- Parameters:
v- visitorcontext- context of visit- Returns:
- result of visit
-