Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
xml-commons External Source Code Files
xml-commons External Source Code Files are provided in the source package file, xml-commons-external-1.4.01-src.zip.
You can download xml-commons-external-1.4.01-src.zip as described in the previous tutorial
You can also browse xml-commons External Source Code below:
✍: FYIcenter
⏎ org/xml/sax/helpers/NewInstance.java
// NewInstance.java - create a new instance of a class by name. // http://www.saxproject.org // Written by Edwin Goei, edwingo@apache.org // and by David Brownell, dbrownell@users.sourceforge.net // NO WARRANTY! This class is in the Public Domain. // $Id: NewInstance.java 670295 2008-06-22 01:46:43Z mrglavas $ package org.xml.sax.helpers; /** * Create a new instance of a class by name. * * <blockquote> * <em>This module, both source code and documentation, is in the * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> * for further information. * </blockquote> * * <p>This class contains a static method for creating an instance of a * class from an explicit class name. It tries to use the thread's context * ClassLoader if possible and falls back to using * Class.forName(String). It also takes into account JDK 1.2+'s * AccessController mechanism for performing its actions. </p> * * <p>This code is designed to compile and run on JDK version 1.1 and later * including versions of Java 2.</p> * * <p>This is <strong>not</strong> the NewInstance accompanying SAX 2.0.2; it * represents many fixes to that code. * * @author Edwin Goei, David Brownell * @version 2.0.1 (sax2r2) */ class NewInstance { // constants // governs whether, if we fail in finding a class even // when given a classloader, we'll make a last-ditch attempt // to use the current classloader. private static final boolean DO_FALLBACK = true; /** * Creates a new instance of the specified class name * * Package private so this code is not exposed at the API level. */ static Object newInstance (ClassLoader classLoader, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Class driverClass; if (classLoader == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. driverClass = Class.forName(className); } else { try { driverClass = classLoader.loadClass(className); } catch (ClassNotFoundException x) { if (DO_FALLBACK) { // Fall back to current classloader classLoader = NewInstance.class.getClassLoader(); if (classLoader != null) { driverClass = classLoader.loadClass(className); } else { driverClass = Class.forName(className); } } else { throw x; } } } Object instance = driverClass.newInstance(); return instance; } /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader getClassLoader () { // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader cl = SecuritySupport.getContextClassLoader(); if (cl == null) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // so use the current ClassLoader cl = NewInstance.class.getClassLoader(); } return cl; } }
⏎ org/xml/sax/helpers/NewInstance.java
⇒ Donwload xml-commons-external-1.3.05-bin.zip
⇐ Download and Install xml-commons External Source Package
2009-01-25, 32669👍, 0💬
Popular Posts:
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
What Is poi-contrib-3.5.jar? poi-contrib-3.5.jar is one of the JAR files for Apache POI 3.5, which p...
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...
Apache Commons Lang 3 is the 3rd version of Apache Commons Lang, which provides a host of helper uti...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...