Skip to content

Commit

Permalink
Merge pull request #21 from caelum/parameterIncluderOnlyWithAnnotation
Browse files Browse the repository at this point in the history
Parameter includer only with annotation
  • Loading branch information
Turini committed Aug 2, 2013
2 parents 1e64a27 + 8a581fa commit 3981426
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
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
*/
@Intercepts(
after=ParametersInstantiatorInterceptor.class
)
@AcceptsWithAnnotations(IncludeParameters.class)
public class ParameterIncluderInterceptor {

private MethodInfo info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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){
}
}

0 comments on commit 3981426

Please sign in to comment.