Skip to content

Commit 3b77339

Browse files
committed
Replace usage of TypeResolverBuilder.init
1 parent 97c14f1 commit 3b77339

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,9 @@ public ObjectMapper activateDefaultTyping(PolymorphicTypeValidator ptv,
19931993

19941994
TypeResolverBuilder<?> typer = _constructDefaultTypeResolverBuilder(applicability, ptv);
19951995
// we'll always use full class name, when using defaulting
1996-
typer = typer.init(JsonTypeInfo.Id.CLASS, null);
1997-
typer = typer.inclusion(includeAs);
1996+
JsonTypeInfo.Value typeInfo = JsonTypeInfo.Value.construct(JsonTypeInfo.Id.CLASS, includeAs,
1997+
null, null, false, null);
1998+
typer = typer.init(typeInfo, null);
19981999
return setDefaultTyping(typer);
19992000
}
20002001

@@ -2023,9 +2024,9 @@ public ObjectMapper activateDefaultTypingAsProperty(PolymorphicTypeValidator ptv
20232024
TypeResolverBuilder<?> typer = _constructDefaultTypeResolverBuilder(applicability,
20242025
ptv);
20252026
// we'll always use full class name, when using defaulting
2026-
typer = typer.init(JsonTypeInfo.Id.CLASS, null);
2027-
typer = typer.inclusion(JsonTypeInfo.As.PROPERTY);
2028-
typer = typer.typeProperty(propertyName);
2027+
JsonTypeInfo.Value typeInfo = JsonTypeInfo.Value.construct(JsonTypeInfo.Id.CLASS, JsonTypeInfo.As.PROPERTY,
2028+
propertyName, null, false, null);
2029+
typer = typer.init(typeInfo, null);
20292030
return setDefaultTyping(typer);
20302031
}
20312032

src/main/java/com/fasterxml/jackson/databind/jsontype/TypeResolverBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
* handling type information embedded in JSON to allow for safe
1616
* polymorphic type handling.
1717
*<p>
18-
* Builder is first initialized by calling {@link #init} method, and then
19-
* configured using 'set' methods like {@link #inclusion}.
18+
* Builder is first initialized by calling {@link #init(JsonTypeInfo.Value, TypeIdResolver)} method, with
19+
* configurations passed in through {@link JsonTypeInfo.Value} that is constructed by
20+
* {@link JsonTypeInfo.Value#construct(JsonTypeInfo.Id, As, String, Class, boolean, Boolean)}.
2021
* Finally, after calling all configuration methods,
2122
* {@link #buildTypeSerializer} or {@link #buildTypeDeserializer}
2223
* will be called to get actual type resolver constructed

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/StdTypeResolverBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ protected StdTypeResolverBuilder(StdTypeResolverBuilder base,
115115
}
116116

117117
public static StdTypeResolverBuilder noTypeInfoBuilder() {
118-
return new StdTypeResolverBuilder().init(JsonTypeInfo.Id.NONE, null);
118+
JsonTypeInfo.Value typeInfo = JsonTypeInfo.Value.construct(JsonTypeInfo.Id.NONE, null,
119+
null, null, false, null);
120+
return new StdTypeResolverBuilder().init(typeInfo, null);
119121
}
120122

121123
@Override

0 commit comments

Comments
 (0)