Package com._1c.g5.v8.dt.lifecycle
Annotation Interface LifecycleParticipant
Annotates the lifecycle participating method.
The method visibility doesn't matter.
This annotation is used in conjunction with LifecycleService
annotation. It allows to mark lifecycle service
methods and point the phase it participates and the dependencies to other services.
The requirements for lifecycle participant method:
- The method may have zero, one or two arguments
- The method arguments types must be
LifecyclePhase
type orILifecycleContext
or its succesor - The method with two arguments must have arguments with different types
- The method should be of
void
type
ILifecycleContext
successor type, it means the method will
participate only if the actual type of the lifecycle context to process is of the same type or is assignable from it.
The method visibility doesn't matter.
The 'phase' attribute is required and 'dependsOn' has default empty value.
Example:
@LifecycleService(name = "MyService") public class MyService { @LifecycleParticipant(phase = LifecyclePhase.CHECKING) public void check() { // ... } @LifecycleParticipant(phase = LifecyclePhase.INITIALIZATION) public void init(LifecyclePhase phase) { // ... } @LifecycleParticipant(phase = LifecyclePhase.RESOURCE_LOADING) public void load(ILifecycleContext context) { // ... } @LifecycleParticipant(phase = LifecyclePhase.POST_RESOURCE_LOADING) public void postLoad(ILifecycleContext context, LifecyclePhase phase) { // empty } @LifecycleParticipant(phase = LifecyclePhase.STORAGE_INITIALIZATION) protected void initStorage(LifecyclePhase phase, ILifecycleContext context) { // empty } @LifecycleParticipant(phase = LifecyclePhase.STORAGE_CLOSING) private void closeStorage(TestContext context) { // invoked only for TestContext type. // ... }
- Since:
- 3.0.0
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionThe participating lifecycle phase. -
Optional Element Summary
Optional Elements
-
Element Details
-
phase
LifecyclePhase phaseThe participating lifecycle phase.- Returns:
- the lifecycle phase, never
null
.
-
-
-
dependsOn
String[] dependsOnReturns an array of lifecycle services names that are dependencies for the current participant.- Returns:
- the dependencies array, never
null
.
- Default:
- {}
-