Class JsonSchemaIdResolver

java.lang.Object
com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
com.fasterxml.jackson.module.jsonSchema.jakarta.JsonSchemaIdResolver
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsontype.TypeIdResolver

public class JsonSchemaIdResolver extends com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
Type id resolver needed to support polymorphic (de)serialization of all kinds of JsonSchema instances. Note that to support custom types, you will need to sub-class this resolver and override at least idFromValue(Object), idFromValueAndType(Object, Class) and typeFromId(com.fasterxml.jackson.databind.DatabindContext, java.lang.String) methods; as well as associate this resolver using JsonTypeInfo annotation on all custom JsonSchema implementation classes.
  • Constructor Details

    • JsonSchemaIdResolver

      public JsonSchemaIdResolver()
  • Method Details

    • idFromValue

      public String idFromValue(Object value)
    • idFromValueAndType

      public String idFromValueAndType(Object value, Class<?> suggestedType)
    • typeFromId

      public com.fasterxml.jackson.databind.JavaType typeFromId(com.fasterxml.jackson.databind.DatabindContext ctxt, String id)
      Specified by:
      typeFromId in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      Overrides:
      typeFromId in class com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
    • getMechanism

      public com.fasterxml.jackson.annotation.JsonTypeInfo.Id getMechanism()
    • init

      public void init(com.fasterxml.jackson.databind.JavaType baseType)
      Specified by:
      init in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      Overrides:
      init in class com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase
    • idFromBaseType

      public String idFromBaseType()
      Specified by:
      idFromBaseType in interface com.fasterxml.jackson.databind.jsontype.TypeIdResolver
      Overrides:
      idFromBaseType in class com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase