org.hibernate.transform
Class DistinctRootEntityResultTransformer

java.lang.Object
  extended by org.hibernate.transform.DistinctRootEntityResultTransformer
All Implemented Interfaces:
Serializable, ResultTransformer, TupleSubsetResultTransformer

public class DistinctRootEntityResultTransformer
extends Object
implements TupleSubsetResultTransformer

Much like RootEntityResultTransformer, but we also distinct the entity in the final result.

Since this transformer is stateless, all instances would be considered equal. So for optimization purposes we limit it to a single, singleton instance.

See Also:
Serialized Form

Field Summary
static DistinctRootEntityResultTransformer INSTANCE
           
 
Method Summary
 boolean[] includeInTransform(String[] aliases, int tupleLength)
          Returns an array with the i-th element indicating whether the i-th element of the tuple is included in the transformed value.
 boolean isTransformedValueATupleElement(String[] aliases, int tupleLength)
          When a tuple is transformed, is the result a single element of the tuple?
 List transformList(List list)
          Simply delegates to DistinctResultTransformer.transformList(java.util.List).
 Object transformTuple(Object[] tuple, String[] aliases)
          Simply delegates to RootEntityResultTransformer.transformTuple(java.lang.Object[], java.lang.String[]).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final DistinctRootEntityResultTransformer INSTANCE
Method Detail

transformTuple

public Object transformTuple(Object[] tuple,
                             String[] aliases)
Simply delegates to RootEntityResultTransformer.transformTuple(java.lang.Object[], java.lang.String[]).

Specified by:
transformTuple in interface ResultTransformer
Parameters:
tuple - The tuple to transform
aliases - The tuple aliases
Returns:
The transformed tuple row.

transformList

public List transformList(List list)
Simply delegates to DistinctResultTransformer.transformList(java.util.List).

Specified by:
transformList in interface ResultTransformer
Parameters:
list - The list to transform.
Returns:
The transformed List.

includeInTransform

public boolean[] includeInTransform(String[] aliases,
                                    int tupleLength)
Returns an array with the i-th element indicating whether the i-th element of the tuple is included in the transformed value.

Specified by:
includeInTransform in interface TupleSubsetResultTransformer
Parameters:
aliases - - the aliases that correspond to the tuple
tupleLength - - the number of elements in the tuple
Returns:
array with the i-th element indicating whether the i-th element of the tuple is included in the transformed value.

isTransformedValueATupleElement

public boolean isTransformedValueATupleElement(String[] aliases,
                                               int tupleLength)
When a tuple is transformed, is the result a single element of the tuple?

Specified by:
isTransformedValueATupleElement in interface TupleSubsetResultTransformer
Parameters:
aliases - - the aliases that correspond to the tuple
tupleLength - - the number of elements in the tuple
Returns:
true, if the transformed value is a single element of the tuple; false, otherwise.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.