Package org.apache.commons.discovery.tools

Examples of org.apache.commons.discovery.tools.DiscoverClass.find()


        org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);

        ClassLoaders loaders = ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
       
        DiscoverClass discover = new DiscoverClass(loaders);
        Class implClass = discover.find(TestInterface2.class);
       
        assertTrue("Failed to find an implementation class", implClass != null);
        assertEquals("org.apache.commons.discovery.test.TestImpl2_1", implClass.getName());
       
    }
View Full Code Here


    @Test
    public void findViaDiscoverClass() {
        ClassLoaders loaders = ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);

        DiscoverClass discover = new DiscoverClass(loaders);
        Class<? extends TestInterface2> implClass = discover.find(TestInterface2.class);

        assertTrue("Failed to find an implementation class", implClass != null);
        assertEquals("org.apache.commons.discovery.test.TestImpl2_1", implClass.getName());
    }
View Full Code Here

    @Test
    public void findInnerImplViaDiscoverClass() {
        ClassLoaders loaders = ClassLoaders.getAppLoaders(TestInterface3.class, getClass(), false);

        DiscoverClass discover = new DiscoverClass(loaders);
        Class<? extends TestInterface3> implClass = discover.find(TestInterface3.class);

        assertTrue("Failed to find an implementation class", implClass != null);
        assertEquals("org.apache.commons.discovery.test.TestImpl3$InnerTestImpl", implClass.getName());

    }
View Full Code Here

                                                         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

        org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);

        ClassLoaders loaders = ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
       
        DiscoverClass discover = new DiscoverClass(loaders);
        Class implClass = discover.find(TestInterface2.class);
       
        assertTrue("Failed to find an implementation class", implClass != null);
        assertEquals("org.apache.commons.discovery.test.TestImpl2_1", implClass.getName());
       
    }
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());
            ControlBeanContextFactory factory = (ControlBeanContextFactory)factoryClass.newInstance();
            _cbc = factory.instantiate(this);
        }
        catch (Exception e) {
            throw new ControlException("Exception creating ControlBeanContext", e);
View Full Code Here

                                                         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

                                                         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

TOP
Copyright © 2018 www.massapi.com. 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.