Package jodd.db.oom.mapper

Source Code of jodd.db.oom.mapper.BaseResultSetMapper

// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.db.oom.mapper;

import jodd.db.oom.DbOomException;

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

/**
* Common {@link ResultSetMapper} implementation.
*/
public abstract class BaseResultSetMapper implements ResultSetMapper {

  protected final ResultSet resultSet;

  protected BaseResultSetMapper(ResultSet resultSet) {
    this.resultSet = resultSet;
  }

  /**
   * {@inheritDoc}
   */
  public boolean next() {
    try {
      return resultSet.next();
    } catch (SQLException sex) {
      throw new DbOomException(sex);
    }
  }

  /**
   * {@inheritDoc}
   */
  public void close() {
    try {
      resultSet.close();
    } catch (SQLException sex) {
      // ignore
    }
  }

  /**
   * {@inheritDoc}
   */
  public ResultSet getResultSet() {
    return resultSet;
  }


  /**
   * {@inheritDoc}
   */
  public Object parseOneObject(Class... types) {
    return parseObjects(types)[0];
  }

}
TOP

Related Classes of jodd.db.oom.mapper.BaseResultSetMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.