com.simpletasks.dao.impl.jdbc.UserMapper.java Source code

Java tutorial

Introduction

Here is the source code for com.simpletasks.dao.impl.jdbc.UserMapper.java

Source

/*
 * Copyright 2000-2007 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.simpletasks.dao.impl.jdbc;

import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import com.simpletasks.domain.User;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by IntelliJ IDEA.
 * User: Mario Arias
 * Date: 30/05/2008
 * Time: 10:56:58 PM
 */
class UserMapper implements ParameterizedRowMapper<User> {
    // ------------------------ INTERFACE METHODS ------------------------

    // --------------------- Interface RowMapper ---------------------

    public User mapRow(ResultSet resultSet, int i) throws SQLException {
        User user = new User();
        user.setId(resultSet.getInt(1));
        user.setEmail(resultSet.getString(2));
        user.setPassword(resultSet.getString(3));
        user.setName(resultSet.getString(4));
        user.setLastName(resultSet.getString(5));
        return user;
    }
}