I have an annotation called "@ProgressCheck" that we can put on a controller to check the progress of an application. If the application is already submitted or late, then it throws the user to a page appropriate for that situation.
The annotation interface is:
@Retention(RetentionPolicy.RUNTIME)
public @interface ProgressCheck {
}
The "implementation" of that annotation is something like:
@Around("execution(* *(..)) && args(session,..) && @annotation(com.foo.aspects.progress.ProgressCheck)")
public Object progressCheck(ProceedingJoinPoint pjp, HttpSession session) throws Throwable {
Applicant applicant = this.applicationSessionUtils.getApplicant(session);
Application application = this.applicationSessionUtils.getApplication(session);
switch (this.applicantService.getProgress(applicant)) {
case SUBMITTED:
return this.modelAndViewFactory.gotoStatusPage(applicant, application);
case LATE:
return this.modelAndViewFactory.gotoDeadlineMissed(applicant, application);
default:
case IN_PROGRESS:
return pjp.proceed();
}
}
Based on values in the session and database, the annotation's "implementation" allows the user to proceed into a controller, or redirects them to another ModelAndView as appropriate.
I'd like to provide parameters to the annotation and then, in this "implementation" logic, use those parameters to further tune the decision. How, from this logic, without knowing where the annotation is applied, do I access those parameters? Or is there another approach I should be using?