25
25
import com .fasterxml .jackson .databind .jsontype .TypeIdResolver ;
26
26
import com .fasterxml .jackson .databind .jsontype .TypeResolverBuilder ;
27
27
import com .fasterxml .jackson .databind .jsontype .TypeSerializer ;
28
+ import com .fasterxml .jackson .databind .jsontype .impl .StdTypeResolverBuilder ;
29
+ import com .fasterxml .jackson .databind .util .ClassUtil ;
28
30
29
31
/**
30
32
* A {@link TypeResolverBuilder} which produces {@link TypeSerializer}s and {@link TypeDeserializer}s that use
@@ -43,7 +45,18 @@ public class IonAnnotationTypeResolverBuilder
43
45
/**
44
46
* Whether type id should be exposed to deserializers or not
45
47
*/
46
- private boolean typeIdVisible = false ;
48
+ private boolean typeIdVisible ;
49
+
50
+ public IonAnnotationTypeResolverBuilder () {
51
+ }
52
+
53
+ // @since 2.13.1
54
+ protected IonAnnotationTypeResolverBuilder (IonAnnotationTypeResolverBuilder base ,
55
+ Class <?> defaultImpl ) {
56
+ typeIdResolver = base .typeIdResolver ;
57
+ typeIdVisible = base .typeIdVisible ;
58
+ this .defaultImpl = defaultImpl ;
59
+ }
47
60
48
61
@ Override
49
62
public Class <?> getDefaultImpl () {
@@ -108,4 +121,12 @@ public IonAnnotationTypeResolverBuilder typeIdVisibility(boolean isVisible) {
108
121
typeIdVisible = isVisible ;
109
122
return this ;
110
123
}
124
+
125
+ @ Override // @since 2.13.1
126
+ public IonAnnotationTypeResolverBuilder withDefaultImpl (Class <?> newDefaultImpl ) {
127
+ if (newDefaultImpl == defaultImpl ) {
128
+ return this ;
129
+ }
130
+ return new IonAnnotationTypeResolverBuilder (this , defaultImpl );
131
+ }
111
132
}
0 commit comments