Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser;
 
 import java.util.Map;
 
Class similar to BeanPropertyWriter, but that will be used for serializing com.fasterxml.jackson.annotation.JsonAnyGetter annotated (Map) properties
public class AnyGetterWriter
    protected final BeanProperty _property;

    
Method (or field) that represents the "any getter"
    protected final AnnotatedMember _accessor;
    
    protected MapSerializer _serializer;
    
    public AnyGetterWriter(BeanProperty property,
            AnnotatedMember accessorMapSerializer serializer)
    {
         = accessor;
         = property;
         = serializer;
    }
    public void getAndSerialize(Object beanJsonGenerator jgenSerializerProvider provider)
        throws Exception
    {
        Object value = .getValue(bean);
        if (value == null) {
            return;
        }
        if (!(value instanceof Map<?,?>)) {
            throw new JsonMappingException("Value returned by 'any-getter' ("
                    +.getName()+"()) not java.util.Map but "+value.getClass().getName());
        }
        .serializeFields((Map<?,?>) valuejgenprovider);
    }
    // Note: NOT part of ResolvableSerializer...
    public void resolve(SerializerProvider providerthrows JsonMappingException
    {
    }
New to GrepCode? Check out our FAQ X