Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/hibernate/MapResultTransformer.java @ 3689:c938e568c4a2 2.9
merged flys-backend/2.9
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:44 +0200 |
parents | 3d3e40d9d6d7 |
children | 18619c1e7c2a |
comparison
equal
deleted
inserted
replaced
3651:06a65baae494 | 3689:c938e568c4a2 |
---|---|
1 package de.intevation.hibernate; | |
2 | |
3 import java.util.HashMap; | |
4 import java.util.Map; | |
5 | |
6 import org.hibernate.transform.BasicTransformerAdapter; | |
7 | |
8 public class MapResultTransformer | |
9 extends BasicTransformerAdapter | |
10 { | |
11 public static final MapResultTransformer INSTANCE = | |
12 new MapResultTransformer(); | |
13 | |
14 public MapResultTransformer() { | |
15 } | |
16 | |
17 @Override | |
18 public Object transformTuple(Object [] tuple, String [] aliases) { | |
19 Map<String, Object> map = new HashMap<String, Object>(); | |
20 for (int i = 0; i < tuple.length; ++i) { | |
21 map.put(aliases[i], tuple[i]); | |
22 } | |
23 return map; | |
24 } | |
25 } | |
26 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |