Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.ObjectCreator


    public Object createService(ServiceResources resources, final ObjectCreator creator)
    {
        Class proxyClass = createProxyClass(resources);

        ObjectCreator perThreadCreator = new PerThreadServiceCreator(_threadCleanupHub, creator);

        try
        {
            Constructor ctor = proxyClass.getConstructors()[0];
View Full Code Here


                    return _context.getType(beanName);
                }

                public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
                {
                    return new ObjectCreator()
                    {
                        public Object createObject()
                        {
                            return getBean();
                        }
                    };
                }

                public String getServiceId()
                {
                    return beanName;
                }

                public Class getServiceInterface()
                {
                    return getBeanType();
                }

                public String getServiceScope()
                {
                    return IOCConstants.DEFAULT_SCOPE;
                }

                public boolean isEagerLoad()
                {
                    return false;
                }

                /** Returns an empty set, Spring has no concept of a marker annotation. */
                public Set<Class> getMarkers()
                {
                    return Collections.emptySet();
                }

            };

            _serviceDefs.put(beanName, serviceDef);
        }

        // And add one service that is the Spring WebApplicationContext.

        ServiceDef serviceDef = new ServiceDef()
        {

            public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
            {
                return new ObjectCreator()
                {
                    public Object createObject()
                    {
                        return _context;
                    }
View Full Code Here

        if (constructor == null)
            throw new RuntimeException(IOCMessages.noAutobuildConstructor(clazz));

        String description = _classFactory.getConstructorLocation(constructor).toString();

        ObjectCreator creator = new ConstructorServiceCreator(this, description, constructor);

        return clazz.cast(creator.createObject());
    }
View Full Code Here

    private static final String SERVICE_ID = "FooBar";

    @Test
    public void create_after_shutdown()
    {
        ObjectCreator creator = mockObjectCreator();

        replay();

        JustInTimeObjectCreator j = new JustInTimeObjectCreator(null, creator, SERVICE_ID);
View Full Code Here

    }

    @Test
    public void eager_load()
    {
        ObjectCreator creator = mockObjectCreator();
        Object service = new Object();
        ServiceActivityTracker tracker = mockServiceActivityTracker();

        replay();
View Full Code Here

        train_isDebugEnabled(logger, false);

        replay();

        ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
                                                           findMethod(fixture, "build_noargs"));

        Object actual = sc.createObject();

        assertSame(actual, fixture._fie);

        verify();
    }
View Full Code Here

        logger.debug(IOCMessages.invokingMethod(CREATOR_DESCRIPTION));

        replay();

        ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method);

        Object actual = sc.createObject();

        assertSame(actual, fixture._fie);

        verify();
    }
View Full Code Here

        expect(resources.getObject(eq(String.class), isA(AnnotationProvider.class))).andReturn(
                "Injected");

        replay();

        ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method);

        Object actual = sc.createObject();

        assertSame(actual, fixture._fie);

        verify();
    }
View Full Code Here

        train_isDebugEnabled(logger, false);

        replay();

        ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
                                                           findMethod(fixture, "build_injected"));

        Object actual = sc.createObject();

        assertSame(actual, fixture._fie);

        verify();
    }
View Full Code Here

        train_isDebugEnabled(logger, false);

        replay();

        ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
                                                           findMethod(fixture, "buildWithOrderedConfiguration"));

        Object actual = sc.createObject();

        assertSame(actual, fixture._fie);

        verify();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.ObjectCreator

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.