com.fasterxml.jackson.dataformat.ion.polymorphism

## Class IonAnnotationIntrospector

- java.lang.Object
- - com.fasterxml.jackson.databind.AnnotationIntrospector
  - - com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector
    - - com.fasterxml.jackson.dataformat.ion.polymorphism.IonAnnotationIntrospector

- All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned, Serializable

      public class IonAnnotationIntrospector
      extends com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector

  A Jackson `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).

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector

      `com.fasterxml.jackson.databind.AnnotationIntrospector.ReferenceProperty`

  - ### Field Summary

    - ### Fields inherited from class com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector

      `instance`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IonAnnotationIntrospector(boolean resolveAllTypes)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector

      `version`

    - ### Methods inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector

      `_findAnnotation, _hasAnnotation, _hasOneOf, allIntrospectors, allIntrospectors, findAndAddVirtualProperties, findAutoDetectVisibility, findClassDescription, findContentDeserializer, findContentSerializer, findCreatorAnnotation, findCreatorBinding, findDefaultEnumValue, findDeserializationContentConverter, findDeserializationContentType, findDeserializationConverter, findDeserializationKeyType, findDeserializationType, findDeserializer, findEnumValue, findEnumValues, findFilterId, findFormat, findIgnoreUnknownProperties, findImplicitPropertyName, findInjectableValue, findInjectableValueId, findKeyDeserializer, findKeySerializer, findMergeInfo, findNameForDeserialization, findNameForSerialization, findNamingStrategy, findNullSerializer, findObjectIdInfo, findObjectReferenceInfo, findPOJOBuilder, findPOJOBuilderConfig, findPropertiesToIgnore, findPropertiesToIgnore, findPropertyAccess, findPropertyAliases, findPropertyContentTypeResolver, findPropertyDefaultValue, findPropertyDescription, findPropertyIgnorals, findPropertyInclusion, findPropertyIndex, findPropertyTypeResolver, findReferenceType, findRootName, findSerializationContentConverter, findSerializationContentType, findSerializationConverter, findSerializationInclusion, findSerializationInclusionForContent, findSerializationKeyType, findSerializationPropertyOrder, findSerializationSortAlphabetically, findSerializationType, findSerializationTyping, findSerializer, findSetterInfo, findSubtypes, findTypeName, findUnwrappingNameTransformer, findValueInstantiator, findViews, findWrapperName, hasAnyGetter, hasAnyGetterAnnotation, hasAnySetter, hasAnySetterAnnotation, hasAsValue, hasAsValueAnnotation, hasCreatorAnnotation, hasIgnoreMarker, hasRequiredMarker, isAnnotationBundle, isIgnorableType, isTypeId, nopInstance, pair, refineDeserializationType, refineSerializationType, resolveSetterConflict`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IonAnnotationIntrospector

          public IonAnnotationIntrospector(boolean resolveAllTypes)

  - ### Method Detail

    - #### defaultIdResolver

          protected com.fasterxml.jackson.databind.jsontype.TypeIdResolver defaultIdResolver(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
                                                                                             com.fasterxml.jackson.databind.JavaType baseType)

    - #### shouldResolveType

          protected boolean shouldResolveType(com.fasterxml.jackson.databind.introspect.AnnotatedClass ac)

    - #### findTypeResolver

          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)

      Provides a `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()`.
      Overrides:
        `findTypeResolver` in class `com.fasterxml.jackson.databind.AnnotationIntrospector`
      Parameters:
        `config` - a serialization or deserialization config object
        `ac` - an AnnotatedClass representing a (statically configured) base type for type resolution
        `baseType` - a JavaType representing the same class
      Returns:
        a type resolver builder that reads and writes Ion type annotations, or null

Copyright © 2019 FasterXML. All rights reserved.