Class SerializerBase<T>

    • Field Detail

      • _handledType

        protected final Class<T> _handledType
    • Constructor Detail

      • SerializerBase

        protected SerializerBase​(Class<T> t)
      • SerializerBase

        protected SerializerBase​(JavaType type)
        Since:
        1.7
      • SerializerBase

        protected SerializerBase​(Class<?> t,
                                 boolean dummy)
        Alternate constructor that is (alas!) needed to work around kinks of generic type handling
    • Method Detail

      • handledType

        public final Class<T> handledType()
        Description copied from class: JsonSerializer
        Method for accessing type of Objects this serializer can handle. Note that this information is not guaranteed to be exact -- it may be a more generic (super-type) -- but it should not be incorrect (return a non-related type).

        Default implementation will return null, which essentially means same as returning Object.class would; that is, that nothing is known about handled type.

        Overrides:
        handledType in class JsonSerializer<T>
      • createObjectNode

        protected ObjectNode createObjectNode()
      • createSchemaNode

        protected ObjectNode createSchemaNode​(String type,
                                              boolean isOptional)
      • isDefaultSerializer

        protected boolean isDefaultSerializer​(JsonSerializer<?> serializer)
        Method that can be called to determine if given serializer is the default serializer Jackson uses; as opposed to a custom serializer installed by a module or calling application. Determination is done using JacksonStdImpl annotation on serializer class.
        Since:
        1.7
      • wrapAndThrow

        public void wrapAndThrow​(SerializerProvider provider,
                                 Throwable t,
                                 Object bean,
                                 String fieldName)
                          throws IOException
        Method that will modify caught exception (passed in as argument) as necessary to include reference information, and to ensure it is a subtype of IOException, or an unchecked exception.

        Rules for wrapping and unwrapping are bit complicated; essentially:

        • Errors are to be passed as is (if uncovered via unwrapping)
        • "Plain" IOExceptions (ones that are not of type JsonMappingException are to be passed as is
        Throws:
        IOException