package oauth4j.springjdbc;

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

import oauth4j.core.Client;

import org.springframework.jdbc.core.RowMapper;

public class ClientRowMapper implements RowMapper<Client> {

	@Override
	public Client mapRow(ResultSet rs, int rowNum) throws SQLException {
		String clientID = rs.getString("id");
		String hashedSecret = rs.getString("hashed_secret");
		String spaceID = rs.getString("space_id");
		String name = rs.getString("name");
		return Client.valueOf(clientID, hashedSecret, spaceID, name);
	}

}
