@Retention(value=RUNTIME)
@Target(value=METHOD)
@Inherited
@Documented
public @interface Before
Specifies that the annotated method should be run before the specified
LifecycleStage
(s). More than one LifecycleStage can be specified, in which case the
method will be run before each stage. If no LifecycleStage is specified then the
default is to execute the method before LifecycleStage.EventHandling
.
LifecycleStage.RequestInit
and LifecycleStage.ActionBeanResolution
cannot be specified because there is no ActionBean to run a method on before the
ActionBean has been resolved!
The method may have any name, any access specifier (public, private etc.) and must take
no arguments. Methods may return values; if the value is a
Resolution
it will be used immediately to terminate
the request. Any other values returned will be ignored.
Examples:
// Runs before the event handling method has been run @Before public void doStuff() { ... } // Runs before binding and validation are executed @Before(stages = LifecycleStage.BindingAndValidation) public void doPreValidationStuff() { ... } // Runs twice, once before each validation-related stage @Before(stages = {LifecycleStage.BindingAndValidation, LifecycleStage.CustomValidation}) public void doMorePreValidationStuff() { ... }
After
,
BeforeAfterMethodInterceptor
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String[] |
on
Allows the method to be restricted to one or more events.
|
LifecycleStage[] |
stages
One or more lifecycle stages before which the method should be called.
|
public abstract LifecycleStage[] stages
public abstract java.lang.String[] on
? Copyright 2005-2006, Stripes Development Team.