com.fasterxml.jackson.module.hibernate
Class PersistentCollectionSerializer

java.lang.Object
  extended by org.codehaus.jackson.map.JsonSerializer<org.hibernate.collection.PersistentCollection>
      extended by com.fasterxml.jackson.module.hibernate.PersistentCollectionSerializer
All Implemented Interfaces:
org.codehaus.jackson.map.ContextualSerializer<org.hibernate.collection.PersistentCollection>, org.codehaus.jackson.map.ResolvableSerializer

public class PersistentCollectionSerializer
extends org.codehaus.jackson.map.JsonSerializer<org.hibernate.collection.PersistentCollection>
implements org.codehaus.jackson.map.ContextualSerializer<org.hibernate.collection.PersistentCollection>, org.codehaus.jackson.map.ResolvableSerializer

Wrapper serializer used to handle aspects of lazy loading that can be used for Hibernate collection datatypes.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
org.codehaus.jackson.map.JsonSerializer.None
 
Field Summary
protected  boolean _forceLazyLoading
           
protected  org.codehaus.jackson.map.BeanProperty _property
          Property that has collection value to handle
protected  org.codehaus.jackson.type.JavaType _serializationType
          This is the nominal type used to locate actual serializer to use for contents, if this collection is to be serialized.
protected  org.codehaus.jackson.map.JsonSerializer<Object> _serializer
          Serializer to which we delegate if serialization is not blocked.
 
Constructor Summary
PersistentCollectionSerializer(org.codehaus.jackson.map.BeanProperty property, org.codehaus.jackson.type.JavaType type, boolean forceLazyLoading)
           
 
Method Summary
 org.codehaus.jackson.map.JsonSerializer<org.hibernate.collection.PersistentCollection> createContextual(org.codehaus.jackson.map.SerializationConfig config, org.codehaus.jackson.map.BeanProperty property)
          We need to resolve actual serializer once we know the context; specifically must know type of property being serialized.
 void resolve(org.codehaus.jackson.map.SerializerProvider provider)
           
 void serialize(org.hibernate.collection.PersistentCollection coll, org.codehaus.jackson.JsonGenerator jgen, org.codehaus.jackson.map.SerializerProvider provider)
           
 void serializeWithType(org.hibernate.collection.PersistentCollection coll, 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 collection value to handle


_forceLazyLoading

protected final boolean _forceLazyLoading

_serializationType

protected final org.codehaus.jackson.type.JavaType _serializationType
This is the nominal type used to locate actual serializer to use for contents, if this collection is to be serialized.


_serializer

protected org.codehaus.jackson.map.JsonSerializer<Object> _serializer
Serializer to which we delegate if serialization is not blocked.

Constructor Detail

PersistentCollectionSerializer

public PersistentCollectionSerializer(org.codehaus.jackson.map.BeanProperty property,
                                      org.codehaus.jackson.type.JavaType type,
                                      boolean forceLazyLoading)
Method Detail

createContextual

public org.codehaus.jackson.map.JsonSerializer<org.hibernate.collection.PersistentCollection> createContextual(org.codehaus.jackson.map.SerializationConfig config,
                                                                                                               org.codehaus.jackson.map.BeanProperty property)
                                                                                                        throws org.codehaus.jackson.map.JsonMappingException
We need to resolve actual serializer once we know the context; specifically must know type of property being serialized. If not known

Specified by:
createContextual in interface org.codehaus.jackson.map.ContextualSerializer<org.hibernate.collection.PersistentCollection>
Throws:
org.codehaus.jackson.map.JsonMappingException

resolve

public void resolve(org.codehaus.jackson.map.SerializerProvider provider)
             throws org.codehaus.jackson.map.JsonMappingException
Specified by:
resolve in interface org.codehaus.jackson.map.ResolvableSerializer
Throws:
org.codehaus.jackson.map.JsonMappingException

serialize

public void serialize(org.hibernate.collection.PersistentCollection coll,
                      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.collection.PersistentCollection>
Throws:
IOException
org.codehaus.jackson.JsonProcessingException

serializeWithType

public void serializeWithType(org.hibernate.collection.PersistentCollection coll,
                              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.collection.PersistentCollection>
Throws:
IOException
org.codehaus.jackson.JsonProcessingException


Copyright © 2011 fasterxml.com. All Rights Reserved.