Mercurial > dive4elements > river
view backend/src/main/java/de/intevation/hibernate/MapResultTransformer.java @ 5861:172338b1407f
GWT client: Added copyright header.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 14:30:15 +0200 |
parents | 4dd33b86dc61 |
children |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.hibernate; import java.util.HashMap; import java.util.Map; import org.hibernate.transform.BasicTransformerAdapter; public class MapResultTransformer extends BasicTransformerAdapter { public static final MapResultTransformer INSTANCE = new MapResultTransformer(); public MapResultTransformer() { } @Override public Object transformTuple(Object [] tuple, String [] aliases) { Map<String, Object> map = new HashMap<String, Object>(); for (int i = 0; i < tuple.length; ++i) { map.put(aliases[i], tuple[i]); } return map; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :