src/share/classes/java/sql/SQLInput.java

Print this page




 427      * Reads the next attribute in the stream and returns it as an
 428      * {@code Object} in the Java programming language. The
 429      * actual type of the object returned is determined by the specified
 430      * Java data type, and any customizations present in this
 431      * stream's type map.
 432      *
 433      * <P>A type map is registered with the stream by the JDBC driver before the
 434      * stream is passed to the application.
 435      *
 436      * <P>When the attribute at the head of the stream is an SQL {@code NULL}
 437      * the method returns {@code null}. If the attribute is an SQL
 438      * structured or distinct
 439      * type, it determines the SQL type of the attribute at the head of the stream.
 440      * If the stream's type map has an entry for that SQL type, the driver
 441      * constructs an object of the appropriate class and calls the method
 442      * {@code SQLData.readSQL} on that object, which reads additional data from the
 443      * stream, using the protocol described for that method.
 444      *<p>
 445      * The default implementation will throw {@code SQLFeatureNotSupportedException}
 446      *

 447      * @param type Class representing the Java data type to convert the attribute to.
 448      * @return the attribute at the head of the stream as an {@code Object} in the
 449      * Java programming language;{@code null} if the attribute is SQL {@code NULL}
 450      * @exception SQLException if a database access error occurs
 451      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 452      * this method
 453      * @since 1.8
 454      */
 455     default <T> T readObject(Class<T> type) throws SQLException {
 456        throw new SQLFeatureNotSupportedException();
 457     }
 458 }


 427      * Reads the next attribute in the stream and returns it as an
 428      * {@code Object} in the Java programming language. The
 429      * actual type of the object returned is determined by the specified
 430      * Java data type, and any customizations present in this
 431      * stream's type map.
 432      *
 433      * <P>A type map is registered with the stream by the JDBC driver before the
 434      * stream is passed to the application.
 435      *
 436      * <P>When the attribute at the head of the stream is an SQL {@code NULL}
 437      * the method returns {@code null}. If the attribute is an SQL
 438      * structured or distinct
 439      * type, it determines the SQL type of the attribute at the head of the stream.
 440      * If the stream's type map has an entry for that SQL type, the driver
 441      * constructs an object of the appropriate class and calls the method
 442      * {@code SQLData.readSQL} on that object, which reads additional data from the
 443      * stream, using the protocol described for that method.
 444      *<p>
 445      * The default implementation will throw {@code SQLFeatureNotSupportedException}
 446      *
 447      * @param<T> the type of the class modeled by this Class object
 448      * @param type Class representing the Java data type to convert the attribute to.
 449      * @return the attribute at the head of the stream as an {@code Object} in the
 450      * Java programming language;{@code null} if the attribute is SQL {@code NULL}
 451      * @exception SQLException if a database access error occurs
 452      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 453      * this method
 454      * @since 1.8
 455      */
 456     default <T> T readObject(Class<T> type) throws SQLException {
 457        throw new SQLFeatureNotSupportedException();
 458     }
 459 }