com.fasterxml.jackson.module.hibernate
Class HibernateProxySerializer

java.lang.Object
  extended by org.codehaus.jackson.map.JsonSerializer<org.hibernate.proxy.HibernateProxy>
      extended by com.fasterxml.jackson.module.hibernate.HibernateProxySerializer

public class HibernateProxySerializer
extends org.codehaus.jackson.map.JsonSerializer<org.hibernate.proxy.HibernateProxy>

Serializer to use for values proxied using HibernateProxy.

TODO: should try to make this work more like Jackson BeanPropertyWriter, possibly sub-classing it -- it handles much of functionality we need, and has access to more information than value serializers (like this one) have.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
org.codehaus.jackson.map.JsonSerializer.None
 
Field Summary
protected  org.codehaus.jackson.map.ser.impl.PropertySerializerMap _dynamicSerializers
          For efficient serializer lookup, let's use this; most of the time, there's just one type and one serializer.
protected  boolean _forceLazyLoading
           
protected  org.codehaus.jackson.map.BeanProperty _property
          Property that has proxy value to handle
 
Constructor Summary
HibernateProxySerializer(org.codehaus.jackson.map.BeanProperty property, boolean forceLazyLoading)
           
 
Method Summary
protected  Object findProxied(org.hibernate.proxy.HibernateProxy proxy)
          Helper method for finding value being proxied, if it is available or if it is to be forced to be loaded.
protected  org.codehaus.jackson.map.JsonSerializer<Object> findSerializer(org.codehaus.jackson.map.SerializerProvider provider, Object value)
           
 void serialize(org.hibernate.proxy.HibernateProxy value, org.codehaus.jackson.JsonGenerator jgen, org.codehaus.jackson.map.SerializerProvider provider)
           
 void serializeWithType(org.hibernate.proxy.HibernateProxy value, org.codehaus.jackson.JsonGenerator jgen, org.codehaus.jackson.map.SerializerProvider provider, org.codehaus.jackson.map.TypeSerializer typeSer)
           
 
Methods inherited from class org.codehaus.jackson.map.JsonSerializer
handledType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_property

protected final org.codehaus.jackson.map.BeanProperty _property
Property that has proxy value to handle


_forceLazyLoading

protected final boolean _forceLazyLoading

_dynamicSerializers

protected org.codehaus.jackson.map.ser.impl.PropertySerializerMap _dynamicSerializers
For efficient serializer lookup, let's use this; most of the time, there's just one type and one serializer.

Constructor Detail

HibernateProxySerializer

public HibernateProxySerializer(org.codehaus.jackson.map.BeanProperty property,
                                boolean forceLazyLoading)
Method Detail

serialize

public void serialize(org.hibernate.proxy.HibernateProxy value,
                      org.codehaus.jackson.JsonGenerator jgen,
                      org.codehaus.jackson.map.SerializerProvider provider)
               throws IOException,
                      org.codehaus.jackson.JsonProcessingException
Specified by:
serialize in class org.codehaus.jackson.map.JsonSerializer<org.hibernate.proxy.HibernateProxy>
Throws:
IOException
org.codehaus.jackson.JsonProcessingException

serializeWithType

public void serializeWithType(org.hibernate.proxy.HibernateProxy value,
                              org.codehaus.jackson.JsonGenerator jgen,
                              org.codehaus.jackson.map.SerializerProvider provider,
                              org.codehaus.jackson.map.TypeSerializer typeSer)
                       throws IOException,
                              org.codehaus.jackson.JsonProcessingException
Overrides:
serializeWithType in class org.codehaus.jackson.map.JsonSerializer<org.hibernate.proxy.HibernateProxy>
Throws:
IOException
org.codehaus.jackson.JsonProcessingException

findSerializer

protected org.codehaus.jackson.map.JsonSerializer<Object> findSerializer(org.codehaus.jackson.map.SerializerProvider provider,
                                                                         Object value)
                                                                  throws IOException,
                                                                         org.codehaus.jackson.JsonProcessingException
Throws:
IOException
org.codehaus.jackson.JsonProcessingException

findProxied

protected Object findProxied(org.hibernate.proxy.HibernateProxy proxy)
Helper method for finding value being proxied, if it is available or if it is to be forced to be loaded.



Copyright © 2011 fasterxml.com. All Rights Reserved.