Java Code Examples for sun.reflect.misc.ReflectUtil#newInstance()

The following examples show how to use sun.reflect.misc.ReflectUtil#newInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SQLInputImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 2
Source File: SQLInputImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 3
Source File: SQLInputImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 4
Source File: SQLInputImpl.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 5
Source File: SQLInputImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 6
Source File: SQLInputImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 7
Source File: SQLInputImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 8
Source File: SQLInputImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 9
Source File: SQLInputImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 10
Source File: SQLInputImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 11
Source File: SQLInputImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Retrieves the value at the head of this <code>SQLInputImpl</code>
 * object as an <code>Object</code> in the Java programming language.  The
 * actual type of the object returned is determined by the default
 * mapping of SQL types to types in the Java programming language unless
 * there is a custom mapping, in which case the type of the object
 * returned is determined by this stream's type map.
 * <P>
 * The JDBC technology-enabled driver registers a type map with the stream
 * before passing the stream to the application.
 * <P>
 * When the datum at the head of the stream is an SQL <code>NULL</code>,
 * this method returns <code>null</code>.  If the datum is an SQL
 * structured or distinct type with a custom mapping, this method
 * determines the SQL type of the datum at the head of the stream,
 * constructs an object of the appropriate class, and calls the method
 * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
 * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
 * methods to retrieve the attribute values from the stream.
 *
 * @return the value at the head of the stream as an <code>Object</code>
 *         in the Java programming language; <code>null</code> if
 *         the value is SQL <code>NULL</code>
 * @throws SQLException if the read position is located at an invalid
 * position; or if there are no further values in the stream.
 */
public Object readObject() throws SQLException {
    Object attrib = getNextAttribute();
    if (attrib instanceof Struct) {
        Struct s = (Struct)attrib;
        // look up the class in the map
        Class<?> c = map.get(s.getSQLTypeName());
        if (c != null) {
            // create new instance of the class
            SQLData obj = null;
            try {
                obj = (SQLData)ReflectUtil.newInstance(c);
            } catch (Exception ex) {
                throw new SQLException("Unable to Instantiate: ", ex);
            }
            // get the attributes from the struct
            Object attribs[] = s.getAttributes(map);
            // create the SQLInput "stream"
            SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
            // read the values...
            obj.readSQL(sqlInput, s.getSQLTypeName());
            return obj;
        }
    }
    return attrib;
}
 
Example 12
Source File: RowSetProvider.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 13
Source File: RowSetProvider.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 14
Source File: RowSetProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 15
Source File: RowSetProvider.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 16
Source File: RowSetProvider.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 17
Source File: RowSetProvider.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 18
Source File: RowSetProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 19
Source File: RowSetProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}
 
Example 20
Source File: RowSetProvider.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Creates a new instance of a <code>RowSetFactory</code>
 * implementation.  This method uses the following
 * look up order to determine
 * the <code>RowSetFactory</code> implementation class to load:</p>
 * <ul>
 * <li>
 * The System property {@code javax.sql.rowset.RowSetFactory}.  For example:
 * <ul>
 * <li>
 * -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
 * </li>
 * </ul>
 * <li>
 * The {@link ServiceLoader} API. The {@code ServiceLoader} API will look
 * for a class name in the file
 * {@code META-INF/services/javax.sql.rowset.RowSetFactory}
 * in jars available to the runtime. For example, to have the the RowSetFactory
 * implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
 * entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
 *  <ul>
 * <li>
 * {@code com.sun.rowset.RowSetFactoryImpl }
 * </li>
 * </ul>
 * </li>
 * <li>
 * Platform default <code>RowSetFactory</code> instance.
 * </li>
 * </ul>
 *
 * <p>Once an application has obtained a reference to a {@code RowSetFactory},
 * it can use the factory to obtain RowSet instances.</p>
 *
 * @return New instance of a <code>RowSetFactory</code>
 *
 * @throws SQLException if the default factory class cannot be loaded,
 * instantiated. The cause will be set to actual Exception
 *
 * @see ServiceLoader
 * @since 1.7
 */
public static RowSetFactory newFactory()
        throws SQLException {
    // Use the system property first
    RowSetFactory factory = null;
    String factoryClassName = null;
    try {
        trace("Checking for Rowset System Property...");
        factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
        if (factoryClassName != null) {
            trace("Found system property, value=" + factoryClassName);
            factory = (RowSetFactory) ReflectUtil.newInstance(getFactoryClass(factoryClassName, null, true));
        }
    }  catch (Exception e) {
        throw new SQLException( "RowSetFactory: " + factoryClassName +
                " could not be instantiated: ", e);
    }

    // Check to see if we found the RowSetFactory via a System property
    if (factory == null) {
        // If the RowSetFactory is not found via a System Property, now
        // look it up via the ServiceLoader API and if not found, use the
        // Java SE default.
        factory = loadViaServiceLoader();
        factory =
                factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
    }
    return (factory);
}