class SimpleResultTransformer implements ResultTransformer {
private static final long serialVersionUID = 1L; private boolean reverseOrder = false;
public SimpleResultTransformer(boolean reverseOrder) { this.reverseOrder = reverseOrder;
}
/**
* Create an object out of each row data.
* In this scenario we have created a company short info
* object from row data.
*/
@Override public Object transformTuple(Object[] rowData, String[] aliasNames) {
Integer compId = (Integer) rowData[0];
String compName = (String) rowData[1];
CompanyShortInfo shortInfo = new CompanyShortInfo(compId, compName); return shortInfo;
}
/**
* Final result list transformation.
*/
@Override public List transformList(List paramList) {
if (reverseOrder) {
Collections.reverse(paramList);
}