13
13
14
14
/**
15
15
* Default {@link TypeResolverBuilder} implementation.
16
- *
17
- * @author tatu
18
16
*/
19
17
public class StdTypeResolverBuilder
20
18
implements TypeResolverBuilder <StdTypeResolverBuilder >
@@ -68,13 +66,12 @@ public StdTypeResolverBuilder init(JsonTypeInfo.Id idType, TypeIdResolver idRes)
68
66
return this ;
69
67
}
70
68
69
+ @ SuppressWarnings ("incomplete-switch" )
71
70
@ Override
72
71
public TypeSerializer buildTypeSerializer (SerializationConfig config ,
73
72
JavaType baseType , Collection <NamedType > subtypes )
74
73
{
75
- if (_idType == JsonTypeInfo .Id .NONE ) {
76
- return null ;
77
- }
74
+ if (_idType == JsonTypeInfo .Id .NONE ) { return null ; }
78
75
TypeIdResolver idRes = idResolver (config , baseType , subtypes , true , false );
79
76
switch (_includeAs ) {
80
77
case WRAPPER_ARRAY :
@@ -91,13 +88,12 @@ public TypeSerializer buildTypeSerializer(SerializationConfig config,
91
88
throw new IllegalStateException ("Do not know how to construct standard type serializer for inclusion type: " +_includeAs );
92
89
}
93
90
91
+ @ SuppressWarnings ("incomplete-switch" )
94
92
@ Override
95
93
public TypeDeserializer buildTypeDeserializer (DeserializationConfig config ,
96
94
JavaType baseType , Collection <NamedType > subtypes )
97
95
{
98
- if (_idType == JsonTypeInfo .Id .NONE ) {
99
- return null ;
100
- }
96
+ if (_idType == JsonTypeInfo .Id .NONE ) { return null ; }
101
97
102
98
TypeIdResolver idRes = idResolver (config , baseType , subtypes , false , true );
103
99
@@ -139,8 +135,7 @@ public StdTypeResolverBuilder inclusion(JsonTypeInfo.As includeAs) {
139
135
* (property name to use for type id when using "as-property" inclusion).
140
136
*/
141
137
@ Override
142
- public StdTypeResolverBuilder typeProperty (String typeIdPropName )
143
- {
138
+ public StdTypeResolverBuilder typeProperty (String typeIdPropName ) {
144
139
// ok to have null/empty; will restore to use defaults
145
140
if (typeIdPropName == null || typeIdPropName .length () == 0 ) {
146
141
typeIdPropName = _idType .getDefaultPropertyName ();
@@ -150,8 +145,7 @@ public StdTypeResolverBuilder typeProperty(String typeIdPropName)
150
145
}
151
146
152
147
@ Override
153
- public StdTypeResolverBuilder defaultImpl (Class <?> defaultImpl )
154
- {
148
+ public StdTypeResolverBuilder defaultImpl (Class <?> defaultImpl ) {
155
149
_defaultImpl = defaultImpl ;
156
150
return this ;
157
151
}
@@ -168,13 +162,9 @@ public StdTypeResolverBuilder typeIdVisibility(boolean isVisible) {
168
162
/**********************************************************
169
163
*/
170
164
171
- public String getTypeProperty () { return _typeProperty ; }
172
-
173
- @ Override
174
- public Class <?> getDefaultImpl () {
175
- return _defaultImpl ;
176
- }
165
+ @ Override public Class <?> getDefaultImpl () { return _defaultImpl ; }
177
166
167
+ public String getTypeProperty () { return _typeProperty ; }
178
168
public boolean isTypeIdVisible () { return _typeIdVisible ; }
179
169
180
170
/*
@@ -189,16 +179,11 @@ public Class<?> getDefaultImpl() {
189
179
* given configuration.
190
180
*/
191
181
protected TypeIdResolver idResolver (MapperConfig <?> config ,
192
- JavaType baseType , Collection <NamedType > subtypes ,
193
- boolean forSer , boolean forDeser )
182
+ JavaType baseType , Collection <NamedType > subtypes , boolean forSer , boolean forDeser )
194
183
{
195
184
// Custom id resolver?
196
- if (_customIdResolver != null ) {
197
- return _customIdResolver ;
198
- }
199
- if (_idType == null ) {
200
- throw new IllegalStateException ("Can not build, 'init()' not yet called" );
201
- }
185
+ if (_customIdResolver != null ) { return _customIdResolver ; }
186
+ if (_idType == null ) throw new IllegalStateException ("Can not build, 'init()' not yet called" );
202
187
switch (_idType ) {
203
188
case CLASS :
204
189
return new ClassNameIdResolver (baseType , config .getTypeFactory ());
0 commit comments