Interface TypeIdResolver

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      JsonTypeInfo.Id getMechanism()
      Accessor for mechanism that this resolver uses for determining type id from type.
      String idFromValue​(Object value)
      Method called to serialize type of the type of given value as a String to include in serialized JSON content.
      String idFromValueAndType​(Object value, Class<?> suggestedType)
      Alternative method used for determining type from combination of value and type, using suggested type (that serializer provides) and possibly value of that type.
      void init​(JavaType baseType)
      Method that will be called once before any type resolution calls; used to initialize instance with configuration.
      JavaType typeFromId​(String id)
      Method called to resolve type from given type identifier.
    • Method Detail

      • init

        void init​(JavaType baseType)
        Method that will be called once before any type resolution calls; used to initialize instance with configuration. This is necessary since instances may be created via reflection, without ability to call specific constructor to pass in configuration settings.
        Parameters:
        baseType - Base type for which this id resolver instance is used
      • idFromValue

        String idFromValue​(Object value)
        Method called to serialize type of the type of given value as a String to include in serialized JSON content.
      • idFromValueAndType

        String idFromValueAndType​(Object value,
                                  Class<?> suggestedType)
        Alternative method used for determining type from combination of value and type, using suggested type (that serializer provides) and possibly value of that type. Most common implementation will use suggested type as is.
        Since:
        1.8
      • typeFromId

        JavaType typeFromId​(String id)
        Method called to resolve type from given type identifier.
      • getMechanism

        JsonTypeInfo.Id getMechanism()
        Accessor for mechanism that this resolver uses for determining type id from type. Mostly informational; not required to be called or used.