Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.ObjectCreator


        ignoreDebug(logger);

        replay();

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

        try
        {
            sc.createObject();
            unreachable();
        } catch (RuntimeException ex)
        {
            assertMessageContains(ex, "build_fail()", "Method failed.");
View Full Code Here


        ignoreDebug(logger);

        replay();

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

        Object actual = sc.createObject();

        verify();

        assertSame(actual, fixture.fie);
    }
View Full Code Here

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

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

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

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


    @Override
    public ObjectCreator constructCreator(final ServiceBuilderResources resources)
    {
        return new ObjectCreator()
        {
            @Override
            public Object createObject()
            {
                return createReloadableProxy(resources);
View Full Code Here

        if (constructor == null)
            throw new RuntimeException(String.format(
                    "Service implementation class %s does not have a suitable public constructor.", clazz.getName()));

        ObjectCreator constructorServiceCreator = new ConstructorServiceCreator(resources, constructor.toString(),
                constructor);

        return constructorServiceCreator.createObject();
    }
View Full Code Here

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

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

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

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

             * that defers its behavior to the lazily invoked invocation.
             */
            @Override
            public void advise(final MethodInvocation invocation)
            {
                ObjectCreator deferred = new ObjectCreator()
                {
                    @Override
                    public Object createObject()
                    {
                        invocation.proceed();

                        return invocation.getReturnValue();
                    }
                };

                ObjectCreator cachingObjectCreator = new CachingObjectCreator(deferred);

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

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

    }

    @Override
    public Object createService(ServiceResources resources, ObjectCreator creator)
    {
        ObjectCreator perThreadCreator = perthreadManager.createValue(creator);

        Class serviceInterface = resources.getServiceInterface();

        return proxyFactory.createProxy(serviceInterface, perThreadCreator, String.format("<PerThread Proxy for %s(%s)>", resources.getServiceId(), serviceInterface.getName()));
    }
View Full Code Here

      this.serviceId = serviceId;
    }

    @Override
    public ObjectCreator createServiceCreator(ServiceBuilderResources resources) {
      return new ObjectCreator() {
        @Override
        public Object createObject() {
          return map.get(serviceId);
        }
      };
View Full Code Here

                    PlasticProxyFactory.class);

            final PersistenceContext annotation = annotationProvider
                    .getAnnotation(PersistenceContext.class);

            proxy = proxyFactory.createProxy(EntityManager.class, new ObjectCreator()
            {
                @Override
                public Object createObject()
                {
                    final EntityManagerManager entityManagerManager = objectLocator
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.