Package com.tnsai.annotations
Annotation Interface AfterActionSpec
Marks a method as a post-action handler that runs after the action completes.
AfterAction methods are called after the action method body executes, allowing for post-processing tasks like:
- Saving results to database
- Writing audit logs
- Updating cache
- Sending notifications
- Triggering follow-up actions
The annotation is placed on the AfterAction method itself, not on the action method. The value specifies which action this AfterAction belongs to.
AfterAction methods can have one of these signatures:
void afterActionMethod(ActionParams params, Object result)void afterActionMethod(ActionParams params)Object afterActionMethod(ActionParams params, Object result)- can modify result
Example usage:
@ActionSpec(type = WEB_SERVICE, endpoint = "...")
public Object getWeather(String location, ActionResult result) {
return formatWeatherResult(result);
}
@AfterActionSpec("getWeather")
public void afterGetWeather(ActionParams params, Object result) {
// Save to database
weatherRepository.save(params.getString("location"), result);
// Write audit log
auditLog.info("Weather queried for: " + params.getString("location"));
}
AfterAction methods can be private, protected, or public.
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe name of the action method this AfterAction belongs to.- Returns:
- the action method name
-