Class StdSerializer<T>

    • Method Detail

      • handledType

        public java.lang.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>
      • serialize

        public abstract void serialize​(T value,
                                       JsonGenerator gen,
                                       SerializerProvider provider)
                                throws java.io.IOException
        Description copied from class: JsonSerializer
        Method that can be called to ask implementation to serialize values of type this serializer handles.
        Specified by:
        serialize in class JsonSerializer<T>
        Parameters:
        value - Value to serialize; can not be null.
        gen - Generator used to output resulting Json content
        provider - Provider that can be used to get serializers for serializing Objects value contains, if any.
        Throws:
        java.io.IOException
      • getSchema

        public JsonNode getSchema​(SerializerProvider provider,
                                  java.lang.reflect.Type typeHint,
                                  boolean isOptional)
                           throws JsonMappingException
        Default implementation simply claims type is "string"; usually overriden by custom serializers.
        Specified by:
        getSchema in interface SchemaAware
        Parameters:
        provider - The serializer provider.
        typeHint - A hint about the type.
        isOptional - Is the type optional
        Returns:
        Json-schema for this serializer.
        Throws:
        JsonMappingException
      • wrapAndThrow

        public void wrapAndThrow​(SerializerProvider provider,
                                 java.lang.Throwable t,
                                 java.lang.Object bean,
                                 java.lang.String fieldName)
                          throws java.io.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:
        java.io.IOException
      • wrapAndThrow

        public void wrapAndThrow​(SerializerProvider provider,
                                 java.lang.Throwable t,
                                 java.lang.Object bean,
                                 int index)
                          throws java.io.IOException
        Throws:
        java.io.IOException