Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.ser;
  
Interface that defines API for simple extensions that can provide additional serializers for various types. Access is by a single callback method; instance is to either return a configured com.fasterxml.jackson.databind.JsonSerializer for specified type, or null to indicate that it does not support handling of the type. In latter case, further calls can be made for other providers; in former case returned serializer is used for handling of instances of specified type.
 
 public interface Serializers
 {
    
Method called by serialization framework first time a serializer is needed for specified type, which is not of a container type (for which other methods are called).

Parameters:
type Fully resolved type of instances to serialize
config Serialization configuration in use
beanDesc Additional information about type
Returns:
Configured serializer to use for the type; or null if implementation does not recognize or support type
 
     public JsonSerializer<?> findSerializer(SerializationConfig config,
             JavaType typeBeanDescription beanDesc);

    
Method called by serialization framework first time a serializer is needed for specified array type. Implementation should return a serializer instance if it supports specified type; or null if it does not.
 
             ArrayType typeBeanDescription beanDesc,
             TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer);

    
Method called by serialization framework first time a serializer is needed for specified java.util.Collection type. Implementation should return a serializer instance if it supports specified type; or null if it does not.
 
             CollectionType typeBeanDescription beanDesc,
             TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer);

    
Method called by serialization framework first time a serializer is needed for specified "Collection-like" type (type that acts like java.util.Collection, but does not implement it). Implementation should return a serializer instance if it supports specified type; or null if it does not.
 
             CollectionLikeType typeBeanDescription beanDesc,
             TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer);
    
    
Method called by serialization framework first time a serializer is needed for specified java.util.Map type. Implementation should return a serializer instance if it supports specified type; or null if it does not.
 
             MapType typeBeanDescription beanDesc,
             JsonSerializer<ObjectkeySerializer,
             TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer);

    
Method called by serialization framework first time a serializer is needed for specified "Map-like" type (type that acts like java.util.Map, but does not implement it). Implementation should return a serializer instance if it supports specified type; or null if it does not.
 
             MapLikeType typeBeanDescription beanDesc,
             JsonSerializer<ObjectkeySerializer,
             TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer);

    
Basic Serializers implementation that implements all methods but provides no serializers. Its main purpose is to serve as a base class so that sub-classes only need to override methods they need.
 
     public static class Base implements Serializers
     {
         @Override
         public JsonSerializer<?> findSerializer(SerializationConfig config,
                 JavaType typeBeanDescription beanDesc)
         {
             return null;
         }
         
        @Override
        public JsonSerializer<?> findArraySerializer(SerializationConfig config,
                ArrayType typeBeanDescription beanDesc,
                TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer)
        {
            return null;
        }
        @Override
                CollectionType typeBeanDescription beanDesc,
                TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer)
        {
            return null;
        }
        @Override
                CollectionLikeType typeBeanDescription beanDesc,
                TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer)
        {
            return null;
        }
            
        @Override
        public JsonSerializer<?> findMapSerializer(SerializationConfig config,
                MapType typeBeanDescription beanDesc,
                JsonSerializer<ObjectkeySerializer,
                TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer)
        {
            return null;
        }
        @Override
        public JsonSerializer<?> findMapLikeSerializer(SerializationConfig config,
                MapLikeType typeBeanDescription beanDesc,
                JsonSerializer<ObjectkeySerializer,
                TypeSerializer elementTypeSerializerJsonSerializer<ObjectelementValueSerializer)
        {
            return null;
        }
    }
New to GrepCode? Check out our FAQ X