snaker-core/src/main/java/org/snaker/engine/access/jdbc/JdbcHelper.java
public static Object getResultSetValue(ResultSet rs, int index, Class<?> requiredType) throws SQLException {
		if (requiredType == null) {
			return getResultSetValue(rs, index);
		}

		Object value = null;
		boolean wasNullCheck = false;

		if (String.class.equals(requiredType)) {
			value = rs.getString(index);
		}
		else if (boolean.class.equals(requiredType) || Boolean.class.equals(requiredType)) {
			value = rs.getBoolean(index);
			wasNullCheck = true;
		}
		else if (byte.class.equals(requiredType) || Byte.class.equals(requiredType)) {
			value = rs.getByte(index);
			wasNullCheck = true;
		}
		else if (short.class.equals(requiredType) || Short.class.equals(requiredType)) {
			value = rs.getShort(index);
			wasNullCheck = true;
		}
		else if (int.class.equals(requiredType) || Integer.class.equals(requiredType)) {
			value = rs.getInt(index);
			wasNullCheck = true;
		}
		else if (long.class.equals(requiredType) || Long.class.equals(requiredType)) {
			value = rs.getLong(index);
			wasNullCheck = true;
		}
		else if (float.class.equals(requiredType) || Float.class.equals(requiredType)) {
			value = rs.getFloat(index);
			wasNullCheck = true;
		}
		else if (double.class.equals(requiredType) || Double.class.equals(requiredType) ||
				Number.class.equals(requiredType)) {
			value = rs.getDouble(index);
			wasNullCheck = true;
		}
		else if (byte[].class.equals(requiredType)) {
			value = rs.getBytes(index);
		}
		else if (java.sql.Date.class.equals(requiredType)) {
			value = rs.getDate(index);
		}
		else if (java.sql.Time.class.equals(requiredType)) {
			value = rs.getTime(index);
		}
		else if (java.sql.Timestamp.class.equals(requiredType) || java.util.Date.class.equals(requiredType)) {
			value = rs.getTimestamp(index);
		}
		else if (BigDecimal.class.equals(requiredType)) {
			value = rs.getBigDecimal(index);
		}
		else if (Blob.class.equals(requiredType)) {
			value = rs.getBlob(index);
		}
		else if (Clob.class.equals(requiredType)) {
			value = rs.getClob(index);
		}
		else {
			value = getResultSetValue(rs, index);
		}

		if (wasNullCheck && value != null && rs.wasNull()) {
			value = null;
		}
		return value;
	}
public static Object getResultSetValue(ResultSet rs, int index, Class<?> requiredType) throws SQLException {
		if (requiredType == null) {
			return getResultSetValue(rs, index);
		}

		Object value = null;
		boolean wasNullCheck = false;

		if (String.class.equals(requiredType)) {
			value = rs.getString(index);
		}
		else if (boolean.class.equals(requiredType) || Boolean.class.equals(requiredType)) {
			value = rs.getBoolean(index);
			wasNullCheck = true;
		}
		else if (byte.class.equals(requiredType) || Byte.class.equals(requiredType)) {
			value = rs.getByte(index);
			wasNullCheck = true;
		}
		else if (short.class.equals(requiredType) || Short.class.equals(requiredType)) {
			value = rs.getShort(index);
			wasNullCheck = true;
		}
		else if (int.class.equals(requiredType) || Integer.class.equals(requiredType)) {
			value = rs.getInt(index);
			wasNullCheck = true;
		}
		else if (long.class.equals(requiredType) || Long.class.equals(requiredType)) {
			value = rs.getLong(index);
			wasNullCheck = true;
		}
		else if (float.class.equals(requiredType) || Float.class.equals(requiredType)) {
			value = rs.getFloat(index);
			wasNullCheck = true;
		}
		else if (double.class.equals(requiredType) || Double.class.equals(requiredType) ||
				Number.class.equals(requiredType)) {
			value = rs.getDouble(index);
			wasNullCheck = true;
		}
		else if (byte[].class.equals(requiredType)) {
			value = rs.getBytes(index);
		}
		else if (java.sql.Date.class.equals(requiredType)) {
			value = rs.getDate(index);
		}
		else if (java.sql.Time.class.equals(requiredType)) {
			value = rs.getTime(index);
		}
		else if (java.sql.Timestamp.class.equals(requiredType) || java.util.Date.class.equals(requiredType)) {
			value = rs.getTimestamp(index);
		}
		else if (BigDecimal.class.equals(requiredType)) {
			value = rs.getBigDecimal(index);
		}
		else if (Blob.class.equals(requiredType)) {
			value = rs.getBlob(index);
		}
		else if (Clob.class.equals(requiredType)) {
			value = rs.getClob(index);
		}
		else {
			value = getResultSetValue(rs, index);
		}

		if (wasNullCheck && value != null && rs.wasNull()) {
			value = null;
		}
		return value;
	}
public static Object getResultSetValue ( ResultSet rs , int index , Class < ? > requiredType ) throws SQLException { if ( requiredType == null ) { return getResultSetValue ( rs , index ) ; } Object value = null ; boolean wasNullCheck = false ; if ( String . class . equals ( requiredType ) ) { value = rs . getString ( index ) ; } else if ( boolean . class . equals ( requiredType ) || Boolean . class . equals ( requiredType ) ) { value = rs . getBoolean ( index ) ; wasNullCheck = true ; } else if ( byte . class . equals ( requiredType ) || Byte . class . equals ( requiredType ) ) { value = rs . getByte ( index ) ; wasNullCheck = true ; } else if ( short . class . equals ( requiredType ) || Short . class . equals ( requiredType ) ) { value = rs . getShort ( index ) ; wasNullCheck = true ; } else if ( int . class . equals ( requiredType ) || Integer . class . equals ( requiredType ) ) { value = rs . getInt ( index ) ; wasNullCheck = true ; } else if ( long . class . equals ( requiredType ) || Long . class . equals ( requiredType ) ) { value = rs . getLong ( index ) ; wasNullCheck = true ; } else if ( float . class . equals ( requiredType ) || Float . class . equals ( requiredType ) ) { value = rs . getFloat ( index ) ; wasNullCheck = true ; } else if ( double . class . equals ( requiredType ) || Double . class . equals ( requiredType ) || Number . class . equals ( requiredType ) ) { value = rs . getDouble ( index ) ; wasNullCheck = true ; } else if ( byte [ ] . class . equals ( requiredType ) ) { value = rs . getBytes ( index ) ; } else if ( java . sql . Date . class . equals ( requiredType ) ) { value = rs . getDate ( index ) ; } else if ( java . sql . Time . class . equals ( requiredType ) ) { value = rs . getTime ( index ) ; } else if ( java . sql . Timestamp . class . equals ( requiredType ) || java . util . Date . class . equals ( requiredType ) ) { value = rs . getTimestamp ( index ) ; } else if ( BigDecimal . class . equals ( requiredType ) ) { value = rs . getBigDecimal ( index ) ; } else if ( Blob . class . equals ( requiredType ) ) { value = rs . getBlob ( index ) ; } else if ( Clob . class . equals ( requiredType ) ) { value = rs . getClob ( index ) ; } else { value = getResultSetValue ( rs , index ) ; } if ( wasNullCheck && value != null && rs . wasNull ( ) ) { value = null ; } return value ; }
根据ResultSet结果集、index列索引、字段类型requiredType获取指定类型的对象值
@param rs
@param index
@param requiredType
@return
@throws SQLException
根据ResultSet结果集、index列索引、字段类型requiredType获取指定类型的对象值