Skip to content

Commit 32951c3

Browse files
committed
...
1 parent e016358 commit 32951c3

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,10 +1279,9 @@ protected TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> config,
12791279
idRes.init(baseType);
12801280
}
12811281
b = b.init(typeInfo.getIdType(), idRes);
1282-
/* 13-Aug-2011, tatu: One complication; external id
1283-
* only works for properties; so if declared for a Class, we will need
1284-
* to map it to "PROPERTY" instead of "EXTERNAL_PROPERTY"
1285-
*/
1282+
// 13-Aug-2011, tatu: One complication; external id
1283+
// only works for properties; so if declared for a Class, we will need
1284+
// to map it to "PROPERTY" instead of "EXTERNAL_PROPERTY"
12861285
JsonTypeInfo.As inclusion = typeInfo.getInclusionType();
12871286
if (inclusion == JsonTypeInfo.As.EXTERNAL_PROPERTY && (ann instanceof AnnotatedClass)) {
12881287
inclusion = JsonTypeInfo.As.PROPERTY;

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,27 @@ public class StdTypeResolverBuilder
4545

4646
public StdTypeResolverBuilder() { }
4747

48+
public StdTypeResolverBuilder(JsonTypeInfo.Value settings) {
49+
if (settings != null) {
50+
_idType = settings.getIdType();
51+
if (_idType == null) {
52+
throw new IllegalArgumentException("idType cannot be null");
53+
}
54+
_includeAs = settings.getInclusionType();
55+
_typeProperty = settings.getPropertyName();
56+
_defaultImpl = settings.getDefaultImpl();
57+
}
58+
}
59+
4860
/**
4961
* @since 2.9
5062
*/
5163
protected StdTypeResolverBuilder(JsonTypeInfo.Id idType,
52-
JsonTypeInfo.As idAs, String propName) {
64+
JsonTypeInfo.As idAs, String propName)
65+
{
66+
if (idType == null) {
67+
throw new IllegalArgumentException("idType cannot be null");
68+
}
5369
_idType = idType;
5470
_includeAs = idAs;
5571
_typeProperty = propName;

0 commit comments

Comments
 (0)