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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.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

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AddEntityCreatorAnnotation

      public AddEntityCreatorAnnotation()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe