Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser.impl;
 
 import java.util.*;
 
 
Optimized lookup table for accessing two types of serializers; typed and non-typed. Only accessed from a single thread, so no synchronization needed for accessors.
public final class ReadOnlyClassToSerializerMap
{
    
Actual mappings from type key to serializers
    protected final JsonSerializerMap _map;

    
We'll reuse key class to avoid unnecessary instantiations; since this is not shared between threads, we can just reuse single instance.
    protected TypeKey _cacheKey = null;
    
    {
         = map;
    }
    {
        return new ReadOnlyClassToSerializerMap();
    }

    
Factory method for creating the "blueprint" lookup map. Such map can not be used as is but just shared: to get an actual usable instance, instance() has to be called first.
    {
        return new ReadOnlyClassToSerializerMap(new JsonSerializerMap(src));
    }
    { 
        if ( == null) {
             = new TypeKey(typetrue);
        } else {
            .resetTyped(type);
        }
        return .find();
    }
    { 
        if ( == null) {
             = new TypeKey(clstrue);
        } else {
            .resetTyped(cls);
        }
        return .find();
    }
    { 
        if ( == null) {
             = new TypeKey(typefalse);
        } else {
            .resetUntyped(type);
        }
        return .find();
    }
    { 
        if ( == null) {
             = new TypeKey(clsfalse);
        } else {
            .resetUntyped(cls);
        }
        return .find();
    }
New to GrepCode? Check out our FAQ X