diff --git a/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/IncludeParameters.java b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/IncludeParameters.java new file mode 100644 index 000000000..4c629a4c3 --- /dev/null +++ b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/IncludeParameters.java @@ -0,0 +1,14 @@ +package br.com.caelum.vraptor4.interceptor; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface IncludeParameters { + +} diff --git a/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/ParameterIncluderInterceptor.java b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/ParameterIncluderInterceptor.java index 7749aa6eb..a46ee3527 100644 --- a/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/ParameterIncluderInterceptor.java +++ b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/ParameterIncluderInterceptor.java @@ -12,8 +12,8 @@ import br.com.caelum.vraptor4.restfulie.controller.ControllerMethod; /** - * An interceptor that auto include all controller method - * parameters to view + * Interceptor that includes all the parameters on the view of + * a method annotated with {@link IncludeParameters} annotation * * @author Rodrigo Turini * @since 4.0 @@ -21,6 +21,7 @@ @Intercepts( after=ParametersInstantiatorInterceptor.class ) +@AcceptsWithAnnotations(IncludeParameters.class) public class ParameterIncluderInterceptor { private MethodInfo info; diff --git a/vraptor-test/src/main/java/br/com/caelum/vrapto4/test/ProfileController.java b/vraptor-test/src/main/java/br/com/caelum/vrapto4/test/ProfileController.java index e5e960fa6..8b7d47c6e 100644 --- a/vraptor-test/src/main/java/br/com/caelum/vrapto4/test/ProfileController.java +++ b/vraptor-test/src/main/java/br/com/caelum/vrapto4/test/ProfileController.java @@ -4,12 +4,14 @@ import br.com.caelum.vraptor4.Controller; import br.com.caelum.vraptor4.Result; +import br.com.caelum.vraptor4.interceptor.IncludeParameters; @Controller public class ProfileController { @Inject private Result result; + @IncludeParameters public void boraLa(Profile profile){ } }