Package org.axonframework.migration
Class AddEntityCreatorAnnotation
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.AddEntityCreatorAnnotation
- All Implemented Interfaces:
Cloneable
public class AddEntityCreatorAnnotation
extends org.openrewrite.Recipe
Adds the
@EntityCreator annotation to existing no-arg constructors of classes annotated with either
@EventSourcedEntity (free AF5) or the Spring stereotype @EventSourced.
Axon Framework 5 makes @EntityCreator mandatory for entity instantiation. The migration guide
recommends the no-arg constructor pattern for most existing aggregates: the framework creates an empty instance,
and the identifier and other state is initialized in the @EventSourcingHandler of the creation event —
exactly the pattern AF4 users already had with their default-constructor-plus-event-sourcing-handler setup.
Idempotent — constructors that already carry @EntityCreator are left alone.
- 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
-
AddEntityCreatorAnnotation
public AddEntityCreatorAnnotation()
-
-
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
-