Class ReplaceAggregateLifecycleApply
- All Implemented Interfaces:
Cloneable
AggregateLifecycle.apply(...) with calls to eventAppender.append(...) on an
injected EventAppender parameter, matching the AF5 entity migration pattern documented at
docs/reference-guide/.../paths/aggregates/index.adoc.
For every method that contains at least one apply(...) call resolved to AF4
org.axonframework.modelling.command.AggregateLifecycle.apply (or its post-Axon4ToAxon5Modelling
location org.axonframework.modelling.entity.AggregateLifecycle.apply), this recipe:
- injects an
EventAppender eventAppenderparameter into the method declaration if one is not already present; - rewrites every matching
apply(X)call inside that method toeventAppender.append(X); - adds the
import org.axonframework.messaging.eventhandling.gateway.EventAppender;import.
apply are left alone, and the
static-import cleanup is handled by maybeRemoveImport.
Constructors are explicitly skipped. AF5 constructors are for entity instantiation; they
have no associated command, so the framework provides no EventAppender for them
to inject. AF4 constructors that emitted a creation event via apply(...) need a
non-mechanical rewrite (the creation event belongs on the static factory method produced
by ConvertCommandHandlerConstructorToStaticMethod, not on the constructor) — the
leftover apply(...) call is left untouched so the developer can decide.
- Since:
- 5.1.1
- Author:
- Mateusz Nowak
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe -
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.openrewrite.TreeVisitor<?, org.openrewrite.ExecutionContext> Methods inherited from class org.openrewrite.Recipe
addDataTable, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions
-
Constructor Details
-
ReplaceAggregateLifecycleApply
public ReplaceAggregateLifecycleApply()
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-