Package org.axonframework.migration
Class CommentOutSerializerConfiguration
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.CommentOutSerializerConfiguration
- All Implemented Interfaces:
Cloneable
public class CommentOutSerializerConfiguration
extends org.openrewrite.Recipe
Comments out Axon Framework 4 serializer configuration under a
// TODO(axon4to5): marker, as Axon Framework
5 replaces the Serializer with a Converter.
Axon Framework 5 has no Serializer, nor a JacksonSerializer, XStreamSerializer or other
implementation of it, so code configuring one does not compile once migrated. The recipe does not port it to a
converter either: the serializer's settings, such as the visibility or default typing of a
JacksonSerializer's ObjectMapper, decide how Axon Framework 5 reads what Axon Framework 4 stored. A
Saga field without accessors, written by a serializer with field visibility, reads back as null when those
settings are dropped. The marker asks to define a converter with the equivalent settings and check it against the
stored data. The recipe comments out, keeping the original source text after //:
- a method returning an Axon Framework 4 serializer type that is a Spring
@Beanmethod or builds a serializer, annotations included; - any other statement building a
JacksonSerializer,Jackson3Serializer,XStreamSerializer,JavaSerializerorAvroSerializer, throughbuilder(),defaultSerializer()or a constructor, such as a field, a local variable or aConfigurercall. Areturnstatement is not commented out on its own, as that leaves a result missing: the method it returns from is commented out, or the statement holding the lambda it returns from.
org.axonframework.serialization package that follows does not import types Axon Framework 5 does not have.
An enum constant building a serializer cannot be commented out on its own and only gets the marker. A statement that
MigrateDeadlineManagerBuilders already marked to replace serializer(..) is left to that marker. The
recipe matches the Axon Framework 4 types, so it runs before the org.axonframework.serialization package is
renamed. It changes Java sources only and is idempotent: commented-out code builds no serializer.- Since:
- 5.4.1
- Author:
- Stefan Dragisic
-
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, aggregateDataTableDescriptors, 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
-
CommentOutSerializerConfiguration
public CommentOutSerializerConfiguration()
-
-
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
-