ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * @param className the name of the class that should be instantiated. * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassLoader loader = NewInstance.getClassLoader ();
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * @param className the name of the class that should be instantiated. * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * @param className the name of the class that should be instantiated. * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }
ClassCastException return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className);
/** * Attempt to create an XML reader from a class name. * * <p>Given a class name, this method attempts to load * and instantiate the class as an XML reader.</p> * * @param className the name of the class that should be instantiated. * * <p>Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.</p> * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); }
private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } }