Java tutorial
/* * SurveyPanel * Copyright (C) 2009 Serge Tan Panza * All rights reserved. * License: GNU/GPL License v3 , see LICENSE.txt * SurveyPanel is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.txt for copyright notices and details. * */ package com.surveypanel.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; import org.springframework.jdbc.core.RowCallbackHandler; /** * @author stanpanza * */ public class MapRowCallbackHandler implements RowCallbackHandler { private Map<String, String> items = new LinkedHashMap<String, String>(); public static String KEY = "name"; public static String VALUE = "value"; /** * @return the items */ public Map<String, String> getItems() { return items; } public void processRow(ResultSet rs) throws SQLException { items.put(rs.getString(KEY), rs.getString(VALUE)); } }