Package org.apache.commons.discovery.tools

Examples of org.apache.commons.discovery.tools.DiscoverClass

  • If the name of the implementation class is non-null, load that class. The class loaded is the first class loaded by the following sequence of class loaders: An exception is thrown if the class cannot be loaded.
  • If the name of the implementation class is null, AND the default implementation class name (defaultImpl) is null, then an exception is thrown.
  • If the name of the implementation class is null, AND the default implementation class (defaultImpl) is non-null, then load the default implementation class. The class loaded is the first class loaded by the following sequence of class loaders:

    This limits the scope in which the default class loader can be found to the SPI, DiscoverSingleton, and System class loaders. The assumption here is that the default implementation is closely associated with the SPI or system, and is not defined in the user's application space.

    An exception is thrown if the class cannot be loaded.

  • Verify that the loaded class implements the SPI: an exception is thrown if the loaded class does not implement the SPI.
  • IMPLEMENTATION NOTE - This implementation is modelled after the SAXParserFactory and DocumentBuilderFactory implementations (corresponding to the JAXP pluggability APIs) found in Apache Xerces.

    @version $Revision: 1090010 $ $Date: 2011-04-07 23:05:58 +0200 (Thu, 07 Apr 2011) $

                                                             ControlBeanContext context,
                                                             String id )
        {
            try
            {
                DiscoverClass discoverer = new DiscoverClass();
                Class factoryClass = discoverer.find( ControlFactory.class, DEFAULT_FACTORY_CLASS );
                ControlFactory factory = (ControlFactory)factoryClass.newInstance();
                return factory.instantiate( beanClass, props, context, id );
            }
            catch ( Exception e )
            {
    View Full Code Here


            }

            // Create the context that acts as the BeanContextProxy for this bean (the context that this bean _defines_).
            try
            {
                DiscoverClass discoverer = new DiscoverClass();
                Class factoryClass =
                    discoverer.find(ControlBeanContextFactory.class, DefaultControlBeanContextFactory.class.getName());

                return (ControlBeanContextFactory)factoryClass.newInstance();
            }
            catch (Exception e) {
                throw new ControlException("Exception creating ControlBeanContext", e);
    View Full Code Here

         * @return a new factory.
         */
        public static TestFactory newInstance() {
            TestFactory factory = null;
            try {
                DiscoverClass dc = new DiscoverClass();
                factory = (TestFactory) dc.newInstance(
                        TestFactory.class,
                "org.apache.commons.math.stat.inference.TestFactoryImpl");
            } catch(Throwable t) {
                return new TestFactoryImpl();
            }
    View Full Code Here

         * @return a new factory.
         */
        public static UnivariateRealSolverFactory newInstance() {
            UnivariateRealSolverFactory factory = null;
            try {
                DiscoverClass dc = new DiscoverClass();
                factory = (UnivariateRealSolverFactory) dc.newInstance(
                    UnivariateRealSolverFactory.class,
                    "org.apache.commons.math.analysis.UnivariateRealSolverFactoryImpl");
            } catch(Throwable t) {
                return new UnivariateRealSolverFactoryImpl();
            }
    View Full Code Here

         * @deprecated to be removed in commons-math 2.0
         */
        public static DescriptiveStatistics newInstance() {
            DescriptiveStatistics factory = null;
            try {
                DiscoverClass dc = new DiscoverClass();
                factory = (DescriptiveStatistics) dc.newInstance(
                    DescriptiveStatistics.class,
                    "org.apache.commons.math.stat.descriptive.DescriptiveStatisticsImpl");
            } catch(Throwable t) {
                return new DescriptiveStatisticsImpl();
            }
    View Full Code Here

         * @deprecated to be removed in commons-math 2.0
         */
        public static SummaryStatistics newInstance() {
            SummaryStatistics instance = null;
            try {
                DiscoverClass dc = new DiscoverClass();
                instance = (SummaryStatistics) dc.newInstance(
                    SummaryStatistics.class,
                    "org.apache.commons.math.stat.descriptive.SummaryStatisticsImpl");
            } catch(Throwable t) {
                return new SummaryStatisticsImpl();
            }
    View Full Code Here

    TOP

    Related Classes of org.apache.commons.discovery.tools.DiscoverClass

    Copyright © 2018 www.massapicom. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.