Top Description Inners Fields Constructors Methods
tools.jackson.databind.cfg

public abstract Class SerializationContexts

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
tools.jackson.databind.cfg.SerializationContexts.DefaultImpl
Imports
tools.jackson.core.TokenStreamFactory, tools.jackson.databind.ObjectMapper, .SerializationConfig, tools.jackson.databind.ser.SerializationContextExt, .SerializerCache, .SerializerFactory

Factory/builder class that replaces Jackson 2.x concept of "blueprint" instance of tools.jackson.databind.SerializationContext. It will be constructed and configured during ObjectMapper building phase, and will be called once per writeValue call to construct actual stateful tools.jackson.databind.SerializationContext to use during serialization.

Note that since this object has to be serializable (to allow JDK serialization of mapper instances), tools.jackson.databind.SerializationContext need not be serializable any more.

Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
protected final transient SerializerCache
_cache

Cache for doing type-to-value-serializer lookups.

protected final transient SerializerFactory
_serializerFactory

Factory responsible for constructing standard serializers.

protected final transient TokenStreamFactory
_streamFactory

Low-level TokenStreamFactory that may be used for constructing embedded generators.

private static final long

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public int
cachedSerializersCount()

Method that can be used to determine how many serializers this provider is caching currently (if it does caching: default implementation does) Exact count depends on what kind of serializers get cached; default implementation caches all serializers, including ones that are eagerly constructed (for optimal access speed)

The main use case for this method is to allow conditional flushing of serializer cache, if certain number of entries is reached.

public abstract SerializationContextExt
createContext(SerializationConfig config, GeneratorSettings genSettings)

Factory method for constructing context object for individual writeValue() calls.

public void
flushCachedSerializers()

Method that will drop all serializers currently cached by this provider.

public SerializationContexts
forMapper(Object mapper, SerializationConfig config, TokenStreamFactory tsf, SerializerFactory serializerFactory)

Mutant factory method called when instance is actually created for use by mapper (as opposed to coming into existence during building, module registration).

protected abstract SerializationContexts
forMapper(Object mapper, TokenStreamFactory tsf, SerializerFactory serializerFactory, SerializerCache cache)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_cacheback to summary
protected final transient SerializerCache _cache

Cache for doing type-to-value-serializer lookups.

_serializerFactoryback to summary
protected final transient SerializerFactory _serializerFactory

Factory responsible for constructing standard serializers.

_streamFactoryback to summary
protected final transient TokenStreamFactory _streamFactory

Low-level TokenStreamFactory that may be used for constructing embedded generators.

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

SerializationContextsback to summary
protected SerializationContexts()
SerializationContextsback to summary
protected SerializationContexts(TokenStreamFactory tsf, SerializerFactory serializerFactory, SerializerCache cache)

Method Detail

cachedSerializersCountback to summary
public int cachedSerializersCount()

Method that can be used to determine how many serializers this provider is caching currently (if it does caching: default implementation does) Exact count depends on what kind of serializers get cached; default implementation caches all serializers, including ones that are eagerly constructed (for optimal access speed)

The main use case for this method is to allow conditional flushing of serializer cache, if certain number of entries is reached.

createContextback to summary
public abstract SerializationContextExt createContext(SerializationConfig config, GeneratorSettings genSettings)

Factory method for constructing context object for individual writeValue() calls.

flushCachedSerializersback to summary
public void flushCachedSerializers()

Method that will drop all serializers currently cached by this provider. This can be used to remove memory usage (in case some serializers are only used once or so), or to force re-construction of serializers after configuration changes for mapper than owns the provider.

forMapperback to summary
public SerializationContexts forMapper(Object mapper, SerializationConfig config, TokenStreamFactory tsf, SerializerFactory serializerFactory)

Mutant factory method called when instance is actually created for use by mapper (as opposed to coming into existence during building, module registration). Necessary usually to initialize non-configuration state, such as caching.

forMapperback to summary
protected abstract SerializationContexts forMapper(Object mapper, TokenStreamFactory tsf, SerializerFactory serializerFactory, SerializerCache cache)
tools.jackson.databind.cfg back to summary

public Class SerializationContexts.DefaultImpl

extends SerializationContexts
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from tools.jackson.databind.cfg.SerializationContexts:
_cache_serializerFactory_streamFactory

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public SerializerCache
public SerializationContextExt
createContext(SerializationConfig config, GeneratorSettings genSettings)

Implements abstract tools.jackson.databind.cfg.SerializationContexts.createContext.

Factory method for constructing context object for individual writeValue() calls.

public SerializationContexts
Inherited from tools.jackson.databind.cfg.SerializationContexts:
cachedSerializersCountflushCachedSerializersforMapper

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.cfg.SerializationContexts.serialVersionUID.

Constructor Detail

DefaultImplback to summary
public DefaultImpl()
DefaultImplback to summary
public DefaultImpl(TokenStreamFactory tsf, SerializerFactory serializerFactory, SerializerCache cache)

Method Detail

cacheForTestsback to summary
public SerializerCache cacheForTests()
createContextback to summary
public SerializationContextExt createContext(SerializationConfig config, GeneratorSettings genSettings)

Implements abstract tools.jackson.databind.cfg.SerializationContexts.createContext.

Doc from tools.jackson.databind.cfg.SerializationContexts.createContext.

Factory method for constructing context object for individual writeValue() calls.

Annotations
@Override
forMapperback to summary
public SerializationContexts forMapper(Object mapper, TokenStreamFactory tsf, SerializerFactory serializerFactory, SerializerCache cache)

Implements abstract tools.jackson.databind.cfg.SerializationContexts.forMapper.

Annotations
@Override