![JAR search and dependency download from the Maven repository](/logo.png)
org.codehaus.jackson.map.SerializerProvider Maven / Gradle / Ivy
package org.codehaus.jackson.map;
import java.io.IOException;
import org.codehaus.jackson.*;
/**
* Abstract class that defines API used by {@link ObjectMapper} and
* {@link JsonSerializer}s to obtain serializers capable of serializing
* instances of specific types.
*
* Note about usage: for {@link JsonSerializer} instances, only accessors
* for locating other (sub-)serializers are to be used. {@link ObjectMapper},
* on the other hand, is to initialize recursive serialization process by
* calling {@link #serializeValue}.
*/
public abstract class SerializerProvider
{
/*
//////////////////////////////////////////////////////
// Entry point for ObjectMapper
//////////////////////////////////////////////////////
*/
/**
* The method to be called by {@link ObjectMapper} to
* execute recursive serialization, using serializers that
* this provider has access to.
*
* @param jsf Underlying factory object used for creating serializers
* as needed
*/
public abstract void serializeValue(JsonGenerator jgen, Object value,
SerializerFactory jsf)
throws IOException, JsonGenerationException;
/*
//////////////////////////////////////////////////////
// General serializer locating method
//////////////////////////////////////////////////////
*/
/**
* Method called to get hold of a serializer for a value of given type;
* or if no such serializer can be found, a default handler (which
* may do a best-effort generic serialization or just simply
* throw an exception when invoked).
*
* Note: this method is only called for non-null values; not for keys
* or null values. For these, check out other accessor methods.
*/
public abstract JsonSerializer