public class IonAnnotationIntrospector
extends com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector
AnnotationIntrospector
(essentially an interceptor for
serializer/deserializer construction) that provides type serializer/deserializers that write/read Ion type
annotations.
The logic in this class is very similar to JacksonAnnotationIntrospector
!
We both look at the @JsonTypeResolver, etc annotations and try to make type resolvers.
This class adds a resolveAllTypes
override, which allows for universal polymorphism without needing
any annotations or mixins, and also permits top-level polymorphism -- deserialize to any object without providing its
actual type, as long as type information was serialized. (i.e., ObjectMapper#readValue(serializedData, Object.class))
Note: the provided TypeSerializer
will only write type annotations if the configured
TypeIdResolver
returns non-null.
Note: TypeDeserializer
are actually full-on value deserializers -- all
deserialization logic goes through them (unlike TypeSerializers, which just write the type metadata).
Constructor and Description |
---|
IonAnnotationIntrospector(boolean resolveAllTypes) |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.databind.jsontype.TypeIdResolver |
defaultIdResolver(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
com.fasterxml.jackson.databind.JavaType baseType) |
com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder<?> |
findTypeResolver(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
com.fasterxml.jackson.databind.introspect.AnnotatedClass ac,
com.fasterxml.jackson.databind.JavaType baseType)
Provides a
TypeResolverBuilder if the AnnotatedClass is enabled for type resolving, and a
TypeIdResolver can be instantiated. |
protected boolean |
shouldResolveType(com.fasterxml.jackson.databind.introspect.AnnotatedClass ac) |
version
_findAnnotation, _hasAnnotation, _hasOneOf, allIntrospectors, allIntrospectors, findAndAddVirtualProperties, findAutoDetectVisibility, findClassDescription, findContentDeserializer, findContentSerializer, findCreatorAnnotation, findCreatorBinding, findDefaultEnumValue, findDeserializationContentConverter, findDeserializationContentType, findDeserializationConverter, findDeserializationKeyType, findDeserializationType, findDeserializer, findEnumAliases, findEnumValue, findEnumValues, findFilterId, findFormat, findIgnoreUnknownProperties, findImplicitPropertyName, findInjectableValue, findInjectableValueId, findKeyDeserializer, findKeySerializer, findMergeInfo, findNameForDeserialization, findNameForSerialization, findNamingStrategy, findNullSerializer, findObjectIdInfo, findObjectReferenceInfo, findPOJOBuilder, findPOJOBuilderConfig, findPropertiesToIgnore, findPropertyAccess, findPropertyAliases, findPropertyContentTypeResolver, findPropertyDefaultValue, findPropertyDescription, findPropertyIgnoralByName, findPropertyIgnorals, findPropertyInclusion, findPropertyInclusionByName, findPropertyIndex, findPropertyTypeResolver, findReferenceType, findRenameByField, findRootName, findSerializationContentConverter, findSerializationContentType, findSerializationConverter, findSerializationInclusion, findSerializationInclusionForContent, findSerializationKeyType, findSerializationPropertyOrder, findSerializationSortAlphabetically, findSerializationType, findSerializationTyping, findSerializer, findSetterInfo, findSubtypes, findTypeName, findUnwrappingNameTransformer, findValueInstantiator, findViews, findWrapperName, hasAnyGetter, hasAnyGetterAnnotation, hasAnySetter, hasAnySetterAnnotation, hasAsKey, hasAsValue, hasAsValueAnnotation, hasCreatorAnnotation, hasIgnoreMarker, hasRequiredMarker, isAnnotationBundle, isIgnorableType, isTypeId, nopInstance, pair, refineDeserializationType, refineSerializationType, resolveSetterConflict
public IonAnnotationIntrospector(boolean resolveAllTypes)
protected com.fasterxml.jackson.databind.jsontype.TypeIdResolver defaultIdResolver(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.JavaType baseType)
protected boolean shouldResolveType(com.fasterxml.jackson.databind.introspect.AnnotatedClass ac)
public com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder<?> findTypeResolver(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.introspect.AnnotatedClass ac, com.fasterxml.jackson.databind.JavaType baseType)
TypeResolverBuilder
if the AnnotatedClass
is enabled for type resolving, and a
TypeIdResolver
can be instantiated.
The AnnotatedClass is enabled for type resolving if either resolveAllTypes
is set, or shouldResolveType()
returns true.
We look for a TypeIdResolver by checking for a JsonTypeIdResolver
annotation, and fallback to
defaultIdResolver()
.
findTypeResolver
in class com.fasterxml.jackson.databind.AnnotationIntrospector
config
- a serialization or deserialization config objectac
- an AnnotatedClass representing a (statically configured) base type for type resolutionbaseType
- a JavaType representing the same classCopyright © 2020 FasterXML. All rights reserved.