com.mysema.query.types
Class MappingProjection<T>

java.lang.Object
  extended by com.mysema.query.types.ExpressionBase<T>
      extended by com.mysema.query.types.MappingProjection<T>
Type Parameters:
T - expression type
All Implemented Interfaces:
Expression<T>, FactoryExpression<T>, Serializable

public abstract class MappingProjection<T>
extends ExpressionBase<T>
implements FactoryExpression<T>

Projection template that allows implementing arbitrary mapping of rows to result objects.

See Also:
Serialized Form

Constructor Summary
MappingProjection(Class<? super T> type, Expression<?>... args)
           
MappingProjection(Class<? super T> type, Expression<?>[]... args)
           
 
Method Summary
<R,C> R
accept(Visitor<R,C> v, C context)
          Accept the visitor with the given context
 List<Expression<?>> getArgs()
          Get the invocation arguments
protected abstract  T map(Tuple row)
          Creates a result object from the given row.
 T newInstance(Object... values)
          Create a projection with the given arguments
 
Methods inherited from class com.mysema.query.types.ExpressionBase
getType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mysema.query.types.Expression
getType
 

Constructor Detail

MappingProjection

public MappingProjection(Class<? super T> type,
                         Expression<?>... args)

MappingProjection

public MappingProjection(Class<? super T> type,
                         Expression<?>[]... args)
Method Detail

newInstance

public T newInstance(Object... values)
Description copied from interface: FactoryExpression
Create a projection with the given arguments

Specified by:
newInstance in interface FactoryExpression<T>
Returns:

map

protected abstract T map(Tuple row)
Creates a result object from the given row.

Parameters:
row - The row to map
Returns:
The result object

getArgs

public List<Expression<?>> getArgs()
Description copied from interface: FactoryExpression
Get the invocation arguments

Specified by:
getArgs in interface FactoryExpression<T>
Returns:

accept

public <R,C> R accept(Visitor<R,C> v,
                      @Nullable
                      C context)
Description copied from interface: Expression
Accept the visitor with the given context

Specified by:
accept in interface Expression<T>
Type Parameters:
R - return type
C - context type
Parameters:
v - visitor
context - context of visit
Returns:


Copyright © 2007-2011 Mysema Ltd. All Rights Reserved.