Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.ObjectCreator


        SpringModuleDef moduleDef = new SpringModuleDef(servletContext);

        ServiceDef serviceDef = moduleDef.getServiceDef(SpringModuleDef.SERVICE_ID);

        ObjectCreator serviceCreator = serviceDef.createServiceCreator(resources);

        assertSame(serviceCreator.createObject(), ac);

        verify();

        // Now, let's test for some of the services.
View Full Code Here


             * When the method is invoked, we don't immediately proceed. Intead, we return a thunk instance
             * that defers its behavior to the lazily invoked invocation.
             */
            public void advise(final Invocation invocation)
            {
                ObjectCreator deferred = new ObjectCreator()
                {
                    public Object createObject()
                    {
                        invocation.proceed();

                        return invocation.getResult();
                    }
                };

                ObjectCreator cachingObjectCreator = new CachingObjectCreator(deferred);

                Object thunk = thunkCreator.createThunk(thunkType, cachingObjectCreator, description);

                invocation.overrideResult(thunk);
            }
View Full Code Here

    public <T> T invoke(Class<T> proxyType, Invokable<T> invocable)
    {
        final Future<T> future = invoke(invocable);

        ObjectCreator creator = new ObjectCreator()
        {
            public Object createObject()
            {
                try
                {
View Full Code Here

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

        ObjectCreator perThreadCreator = new PerThreadServiceCreator(perthreadManager, creator);

        try
        {
            Constructor ctor = proxyClass.getConstructors()[0];
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

        train_isDebugEnabled(logger, false);

        replay();

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

        Object actual = sc.createObject();

        assertSame(actual, fixture.fie);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.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.