com.atlassian.jira.rest.api.issue
Class NullRespectingJSONSerializer

java.lang.Object
  extended by org.codehaus.jackson.map.JsonSerializer<Object>
      extended by com.atlassian.jira.rest.api.issue.NullRespectingJSONSerializer

public class NullRespectingJSONSerializer
extends org.codehaus.jackson.map.JsonSerializer<Object>

This serializer writes field-name : null, for java bean fields that are a null reference; otherwise, it uses the default JSON serialization strategy for that field. This is neccesary because we are in a version of Jackson that is stupid and tells you that by default it will serialize null references as field-name : null but it actually does not include the field in the generated JSON at all. Explicit serialization settings do not work either, so we have to force this behaviour through this custom serializer :-(


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
org.codehaus.jackson.map.JsonSerializer.None
 
Constructor Summary
NullRespectingJSONSerializer()
           
 
Method Summary
protected static boolean isPublic(Field field)
           
 void serialize(Object object, org.codehaus.jackson.JsonGenerator jgen, org.codehaus.jackson.map.SerializerProvider provider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullRespectingJSONSerializer

public NullRespectingJSONSerializer()
Method Detail

serialize

public void serialize(Object object,
                      org.codehaus.jackson.JsonGenerator jgen,
                      org.codehaus.jackson.map.SerializerProvider provider)
               throws IOException
Specified by:
serialize in class org.codehaus.jackson.map.JsonSerializer<Object>
Throws:
IOException

isPublic

protected static boolean isPublic(Field field)


Copyright © 2002-2012 Atlassian. All Rights Reserved.