KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > transform > AliasToEntityMapResultTransformer


1 //$Id: AliasToEntityMapResultTransformer.java,v 1.3 2004/08/10 05:06:14 oneovthafew Exp $
2
package org.hibernate.transform;
3
4 import java.util.HashMap JavaDoc;
5 import java.util.List JavaDoc;
6 import java.util.Map JavaDoc;
7
8 /**
9  * @author Gavin King
10  */

11 public class AliasToEntityMapResultTransformer implements ResultTransformer {
12
13     public Object JavaDoc transformTuple(Object JavaDoc[] tuple, String JavaDoc[] aliases) {
14         Map JavaDoc result = new HashMap JavaDoc();
15         for ( int i=0; i<tuple.length; i++ ) {
16             String JavaDoc alias = aliases[i];
17             if ( alias!=null ) {
18                 result.put( alias, tuple[i] );
19             }
20         }
21         return result;
22     }
23
24     public List JavaDoc transformList(List JavaDoc collection) {
25         return collection;
26     }
27
28 }
29
Popular Tags