org.codehaus.jackson.map.SerializerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
package org.codehaus.jackson.map;
import org.codehaus.jackson.map.ser.BeanSerializerModifier;
import org.codehaus.jackson.type.JavaType;
/**
* Abstract class that defines API used by {@link SerializerProvider}
* to obtain actual
* {@link JsonSerializer} instances from multiple distinct factories.
*/
public abstract class SerializerFactory
{
/*
/**********************************************************
/* Helper class to contain configuration settings
/**********************************************************
*/
/**
* Configuration settings container class for bean serializer factory.
*
* @since 1.7
*/
public abstract static class Config
{
/**
* Method for creating a new instance with additional serializer provider.
*/
public abstract Config withAdditionalSerializers(Serializers additional);
/**
* @since 1.8
*/
public abstract Config withAdditionalKeySerializers(Serializers additional);
/**
* Method for creating a new instance with additional bean serializer modifier.
*/
public abstract Config withSerializerModifier(BeanSerializerModifier modifier);
public abstract boolean hasSerializers();
public abstract boolean hasKeySerializers();
public abstract boolean hasSerializerModifiers();
public abstract Iterable serializers();
public abstract Iterable keySerializers();
public abstract Iterable serializerModifiers();
}
/*
/**********************************************************
/* Additional configuration
/**********************************************************
*/
/**
* @since 1.7
*/
public abstract Config getConfig();
/**
* Method used for creating a new instance of this factory, but with different
* configuration. Reason for specifying factory method (instead of plain constructor)
* is to allow proper sub-classing of factories.
*
* Note that custom sub-classes generally must override implementation
* of this method, as it usually requires instantiating a new instance of
* factory type. Check out javadocs for
* {@link org.codehaus.jackson.map.ser.BeanSerializerFactory} for more details.
*
* @since 1.7
*/
public abstract SerializerFactory withConfig(Config config);
/**
* Convenience method for creating a new factory instance with additional serializer
* provider; equivalent to calling
*
* withConfig(getConfig().withAdditionalSerializers(additional));
*
*
* @since 1.7
*/
public final SerializerFactory withAdditionalSerializers(Serializers additional) {
return withConfig(getConfig().withAdditionalSerializers(additional));
}
/**
* @since 1.8
*/
public final SerializerFactory withAdditionalKeySerializers(Serializers additional) {
return withConfig(getConfig().withAdditionalKeySerializers(additional));
}
/**
* Convenience method for creating a new factory instance with additional bean
* serializer modifier; equivalent to calling
*
* withConfig(getConfig().withSerializerModifier(modifier));
*
*
* @since 1.7
*/
public final SerializerFactory withSerializerModifier(BeanSerializerModifier modifier) {
return withConfig(getConfig().withSerializerModifier(modifier));
}
/*
/**********************************************************
/* Basic SerializerFactory API:
/**********************************************************
*/
/**
* Method called to create (or, for immutable serializers, reuse) a serializer for given type.
*/
public abstract JsonSerializer