Cache contains three kinds of entries, based on combination of class pair key. First class in key is for the type to serialize, and second one is type used for determining how to resolve value type. One (but not both) of entries can be null.
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicReference | _readOnlyMap
Most recent read-only instance, created from _sharedMap, if any. |
| private final LookupCache | _sharedMap
Shared, modifiable map; all access needs to be through synchronized blocks. |
| public static final int | DEFAULT_MAX_CACHE_SIZE
By default, allow caching of up to 4000 serializer entries (for possibly up to 1000 types; but depending access patterns may be as few as half of that). |
| public static final int | DEFAULT_MAX_CACHED
Deprecated
Use
DEFAULT_MAX_CACHE_SIZE instead.
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private final synchronized ReadOnlyClassToSerializerMap | |
| public void | addAndResolveNonTypedSerializer(Class<?> type, JsonSerializer<Object> ser, SerializerProvider provider)
|
| public void | addAndResolveNonTypedSerializer(JavaType type, JsonSerializer<Object> ser, SerializerProvider provider)
|
| public void | addAndResolveNonTypedSerializer(Class<?> rawType, JavaType fullType, JsonSerializer<Object> ser, SerializerProvider provider)
Another alternative that will cover both access via raw type and matching fully resolved type, in one fell swoop. |
| public void | addTypedSerializer(JavaType type, JsonSerializer<Object> ser)
Method called if none of lookups succeeded, and caller had to construct a serializer. |
| public void | |
| public synchronized void | flush()
Method called by StdSerializerProvider#flushCachedSerializers() to clear all cached serializers |
| public ReadOnlyClassToSerializerMap | getReadOnlyLookupMap()
Method that can be called to get a read-only instance populated from the most recent version of the shared lookup Map. |
| public synchronized int | |
| public JsonSerializer | |
| public JsonSerializer | |
| public JsonSerializer | untypedValueSerializer(Class<?> type)
Method that checks if the shared (and hence, synchronized) lookup Map might have untyped serializer for given type. |
| public JsonSerializer |
| _readOnlyMap | back to summary |
|---|---|
| private final AtomicReference<ReadOnlyClassToSerializerMap> _readOnlyMap Most recent read-only instance, created from _sharedMap, if any. | |
| _sharedMap | back to summary |
|---|---|
| private final LookupCache<TypeKey, JsonSerializer<Object>> _sharedMap Shared, modifiable map; all access needs to be through synchronized blocks. Note keys are of various types (see below for key types), in addition to
basic | |
| DEFAULT_MAX_CACHE_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_MAX_CACHE_SIZE By default, allow caching of up to 4000 serializer entries (for possibly up to 1000 types; but depending access patterns may be as few as half of that). | |
| DEFAULT_MAX_CACHED | back to summary |
|---|---|
| public static final int DEFAULT_MAX_CACHED
Deprecated Use | |
| SerializerCache | back to summary |
|---|---|
| public SerializerCache() | |
| SerializerCache | back to summary |
|---|---|
| public SerializerCache(int maxCached) | |
| SerializerCache | back to summary |
|---|---|
public SerializerCache(LookupCache<TypeKey, JsonSerializer<Object>> cache)
| |
| _makeReadOnlyLookupMap | back to summary |
|---|---|
| private final synchronized ReadOnlyClassToSerializerMap _makeReadOnlyLookupMap() | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(Class<?> type, JsonSerializer<Object> ser, SerializerProvider provider) throws JsonMappingException | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(JavaType type, JsonSerializer<Object> ser, SerializerProvider provider) throws JsonMappingException | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(Class<?> rawType, JavaType fullType, JsonSerializer<Object> ser, SerializerProvider provider) throws JsonMappingException Another alternative that will cover both access via raw type and matching fully resolved type, in one fell swoop.
| |
| addTypedSerializer | back to summary |
|---|---|
| public void addTypedSerializer(JavaType type, JsonSerializer<Object> ser) Method called if none of lookups succeeded, and caller had to construct a serializer. If so, we will update the shared lookup map so that it can be resolved via it next time. | |
| addTypedSerializer | back to summary |
|---|---|
| public void addTypedSerializer(Class<?> cls, JsonSerializer<Object> ser) | |
| flush | back to summary |
|---|---|
| public synchronized void flush() Method called by StdSerializerProvider#flushCachedSerializers() to clear all cached serializers | |
| getReadOnlyLookupMap | back to summary |
|---|---|
| public ReadOnlyClassToSerializerMap getReadOnlyLookupMap() Method that can be called to get a read-only instance populated from the most recent version of the shared lookup Map. | |
| size | back to summary |
|---|---|
| public synchronized int size() | |
| typedValueSerializer | back to summary |
|---|---|
| public JsonSerializer | |
| typedValueSerializer | back to summary |
|---|---|
| public JsonSerializer | |
| untypedValueSerializer | back to summary |
|---|---|
| public JsonSerializer Method that checks if the shared (and hence, synchronized) lookup Map might have untyped serializer for given type. | |
| untypedValueSerializer | back to summary |
|---|---|
| public JsonSerializer | |