Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java?rev=1095544&r1=1095543&r2=1095544&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java Wed Apr 20 22:45:44 2011 @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,10 +15,12 @@ package org.apache.tapestry5.ioc.services; import org.apache.tapestry5.ioc.MethodAdvice; +import org.apache.tapestry5.ioc.AnnotationAccess; /** - * A decorator used to create an interceptor that delegates each method's invocation to an {@link - * org.apache.tapestry5.ioc.MethodAdvice} for advice. Advice can inspect or change method parameters, inspect or change + * A decorator used to create an interceptor that delegates each method's invocation to an + * {@link org.apache.tapestry5.ioc.MethodAdvice} for advice. Advice can inspect or change method parameters, inspect or + * change * the method's return value, and inspect and change thrown exceptions (checked and unchecked). */ public interface AspectDecorator @@ -26,26 +28,53 @@ public interface AspectDecorator /** * Intercepts method invocations on the delegate and passes them through the provided aspect. Note that the advice * <em>must</em> be thread-safe. - * - * @param serviceInterface defines the interface of the interceptor and delegate - * @param delegate the object on which methods will be invoked - * @param advice intercepts the method invocations on the delegate - * @param description used as the toString() of the returned interceptor, unless toString() is part of the - * service interface + * + * @param serviceInterface + * defines the interface of the interceptor and delegate + * @param delegate + * the object on which methods will be invoked + * @param advice + * intercepts the method invocations on the delegate + * @param description + * used as the toString() of the returned interceptor, unless toString() is part of the + * service interface * @return the interceptor, wrapping the delegate with all the advice */ <T> T build(Class<T> serviceInterface, T delegate, MethodAdvice advice, String description); /** - * Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to + * Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to * be advised, or when different methods need to receive different advice, or when multiple advice is to be * applied. - * - * @param serviceInterface defines the interface of the interceptor and the delegate - * @param delegate the object on which methods will be invokes - * @param description used as the toString() of the interceptor unless toString() is part of the service - * interface + * + * @param serviceInterface + * defines the interface of the interceptor and the delegate + * @param delegate + * the object on which methods will be invokes + * @param description + * used as the toString() of the interceptor unless toString() is part of the service + * interface * @return a builder that can be used to generate the final interceptor */ <T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface, T delegate, String description); + + /** + * Creates a builder that can be used to create the interceptor. This is used when only some of the methods need to + * be advised, or when different methods need to receive different advice, or when multiple advice is to be + * applied. + * + * @param serviceInterface + * defines the interface of the interceptor and the delegate + * @param delegate + * the object on which methods will be invokes + * @param annotationAccess + * provides access to combined annotations of the underlying service + * and service interface + * @param description + * used as the toString() of the interceptor unless toString() is part of the service + * interface + * @return a builder that can be used to generate the final interceptor + */ + <T> AspectInterceptorBuilder<T> createBuilder(Class<T> serviceInterface, T delegate, + AnnotationAccess annotationAccess, String description); }
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java?rev=1095544&r1=1095543&r2=1095544&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java Wed Apr 20 22:45:44 2011 @@ -72,14 +72,11 @@ public interface PlasticProxyFactory * interface class for proxy * @param creator * object responsible for creating the real object - * @param annotationSource - * if non-null, the class from which annotations should be copied * @param description * the <code>toString()</code> of the proxy * @return proxy instance */ - <T> T createProxy(Class<T> interfaceType, ObjectCreator<T> creator, Class<? extends T> annotationSource, - String description); + <T> T createProxy(Class<T> interfaceType, ObjectCreator<T> creator, String description); /** * Converts a method to a {@link Location}, which includes information about the source file name and line number. Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java?rev=1095544&r1=1095543&r2=1095544&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java Wed Apr 20 22:45:44 2011 @@ -416,26 +416,6 @@ public class IntegrationTest extends IOC } @Test - public void proxy_annotations() throws Exception - { - Registry r = buildRegistry(AutobuildModule.class); - - StringHolder sh = r.getService(StringHolder.class); - - SimpleAnnotation annotation = sh.getClass().getAnnotation(SimpleAnnotation.class); - assertNotNull(annotation); - assertEquals(annotation.value(), "StringHolderImpl"); - - Method method = sh.getClass().getMethod("getValue"); - - annotation = method.getAnnotation(SimpleAnnotation.class); - assertNotNull(annotation); - assertEquals(annotation.value(), "StringHolderImpl#getValue()"); - - r.shutdown(); - } - - @Test public void exception_in_autobuild_service_constructor() { Registry r = buildRegistry(ExceptionInConstructorModule.class); Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java?rev=1095544&r1=1095543&r2=1095544&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java Wed Apr 20 22:45:44 2011 @@ -23,7 +23,7 @@ import org.apache.tapestry5.ioc.Annotati import org.apache.tapestry5.ioc.Registry; import org.apache.tapestry5.ioc.RegistryBuilder; import org.apache.tapestry5.ioc.ServiceDecorator; -import org.apache.tapestry5.ioc.def.ServiceDef; +import org.apache.tapestry5.ioc.def.ServiceDef3; import org.apache.tapestry5.ioc.services.ClassFactory; import org.apache.tapestry5.ioc.services.PlasticProxyFactory; import org.apache.tapestry5.ioc.test.IOCTestCase; @@ -137,7 +137,7 @@ public class IOCInternalTestCase extends { List<ServiceDecorator> result = Collections.emptyList(); - expect(registry.findDecoratorsForService(isA(ServiceDef.class))).andReturn(result); + expect(registry.findDecoratorsForService(isA(ServiceDef3.class))).andReturn(result); } protected final void train_getDescription(ObjectCreatorSource source, String description) Modified: tapestry/tapestry5/trunk/tapestry-jpa/src/test/java/org/apache/tapestry5/internal/jpa/JpaTransactionAdvisorImplTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jpa/src/test/java/org/apache/tapestry5/internal/jpa/JpaTransactionAdvisorImplTest.java?rev=1095544&r1=1095543&r2=1095544&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-jpa/src/test/java/org/apache/tapestry5/internal/jpa/JpaTransactionAdvisorImplTest.java (original) +++ tapestry/tapestry5/trunk/tapestry-jpa/src/test/java/org/apache/tapestry5/internal/jpa/JpaTransactionAdvisorImplTest.java Wed Apr 20 22:45:44 2011 @@ -327,6 +327,8 @@ public class JpaTransactionAdvisorImplTe train_commitActiveTransaction(transaction); replay(); + + try { interceptor.perform();
