public class CacheableResultTransformer extends Object implements ResultTransformer
A ResultTransformer that is used to transform tuples to a value(s) that can be cached.
Modifier and Type | Method and Description |
---|---|
static CacheableResultTransformer |
create(ResultTransformer transformer,
String[] aliases,
boolean[] includeInTuple)
Returns a CacheableResultTransformer that is used to transform
tuples to a value(s) that can be cached.
|
boolean |
equals(Object o) |
Type[] |
getCachedResultTypes(Type[] tupleResultTypes) |
int |
hashCode() |
List |
retransformResults(List transformedResults,
String[] aliases,
ResultTransformer transformer,
boolean[] includeInTuple)
Re-transforms, if necessary, a List of values previously
transformed by this (or an equivalent) CacheableResultTransformer.
|
List |
transformList(List list)
Here we have an opportunity to perform transformation on the
query result as a whole.
|
Object |
transformTuple(Object[] tuple,
String[] aliases)
Tuples are the elements making up each "row" of the query result.
|
List |
untransformToTuples(List results)
Untransforms, if necessary, a List of values previously
transformed by this (or an equivalent) CacheableResultTransformer.
|
public static CacheableResultTransformer create(ResultTransformer transformer, String[] aliases, boolean[] includeInTuple)
Returns a CacheableResultTransformer that is used to transform tuples to a value(s) that can be cached.
transformer
- - result transformer that will ultimately be
be used (after caching results)aliases
- - the aliases that correspond to the tuple;
if it is non-null, its length must equal the number
of true elements in includeInTuple[]includeInTuple
- - array with the i-th element indicating
whether the i-th expression returned by a query is
included in the tuple; the number of true values equals
the length of the tuple that will be transformed;
must be non-nullpublic Object transformTuple(Object[] tuple, String[] aliases)
ResultTransformer
Tuples are the elements making up each "row" of the query result. The contract here is to transform these elements into the final row.
transformTuple
in interface ResultTransformer
tuple
- The result elementsaliases
- The result aliases ("parallel" array to tuple)public List retransformResults(List transformedResults, String[] aliases, ResultTransformer transformer, boolean[] includeInTuple)
Re-transforms, if necessary, a List of values previously transformed by this (or an equivalent) CacheableResultTransformer. Each element of the list is re-transformed in place (i.e, List elements are replaced with re-transformed values) and the original List is returned. <p/> If re-transformation is unnecessary, the original List is returned unchanged.
transformedResults
- - results that were previously transformedaliases
- - the aliases that correspond to the untransformed tuple;transformer
- - the transformer for the re-transformationincludeInTuple
- indicates the indexes ofpublic List untransformToTuples(List results)
Untransforms, if necessary, a List of values previously transformed by this (or an equivalent) CacheableResultTransformer. Each element of the list is untransformed in place (i.e, List elements are replaced with untransformed values) and the original List is returned. <p/> If not unnecessary, the original List is returned unchanged. <p/> NOTE: If transformed values are a subset of the original tuple, then, on return, elements corresponding to excluded tuple elements will be null.
results
- - results that were previously transformedpublic List transformList(List list)
ResultTransformer
Here we have an opportunity to perform transformation on the query result as a whole. This might be useful to convert from one collection type to another or to remove duplicates from the result, etc.
transformList
in interface ResultTransformer
list
- The result.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.