Package org.openrewrite.java.jackson
Class JsonSerializeIncludeToJsonInclude
java.lang.Object
org.openrewrite.Recipe
org.openrewrite.java.jackson.JsonSerializeIncludeToJsonInclude
- All Implemented Interfaces:
Cloneable
public class JsonSerializeIncludeToJsonInclude
extends org.openrewrite.Recipe
Migrates the deprecated
com.fasterxml.jackson.databind.annotation.JsonSerialize(include = Inclusion.X)
shape to com.fasterxml.jackson.annotation.JsonInclude(JsonInclude.Include.X). The include
attribute on @JsonSerialize was deprecated in Jackson 2.x and removed entirely in Jackson 3.x; running
this recipe before the Jackson 2 → 3 package rename produces the correct
tools.jackson.annotation.JsonInclude on the Jackson 3 side instead of a broken
tools.jackson.databind.annotation.JsonSerialize(include = ...).
Other arguments on the original @JsonSerialize (e.g. using) are preserved on the annotation;
if include was the only argument the annotation is removed entirely. If a sibling @JsonInclude
already exists on the same target, the recipe strips include from @JsonSerialize but does not add
a duplicate @JsonInclude (@JsonInclude is not @Repeatable).
-
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, getDescription, getDescriptor, getDisplayName, 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
-
JsonSerializeIncludeToJsonInclude
public JsonSerializeIncludeToJsonInclude()
-
-
Method Details
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-