public class HibernateProxySerializer
extends com.fasterxml.jackson.databind.JsonSerializer<org.hibernate.proxy.HibernateProxy>
implements com.fasterxml.jackson.databind.ser.ContextualSerializer
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.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
HibernateProxySerializer.ProxyReader
Inspects a Hibernate proxy to try and determine the name of the identifier property
(Hibernate proxies know the getter of the identifier property because it receives special
treatment in the invocation handler).
|
protected static class |
HibernateProxySerializer.ProxySessionReader
Hibernate 5.2 broke abi compatibility of org.hibernate.proxy.LazyInitializer.getSession()
The api contract changed
from org.hibernate.proxy.LazyInitializer.getSession()Lorg.hibernate.engine.spi.SessionImplementor;
to org.hibernate.proxy.LazyInitializer.getSession()Lorg.hibernate.engine.spi.SharedSessionContractImplementor
On hibernate 5.2 the interface SessionImplementor extends SharedSessionContractImplementor.
|
| Modifier and Type | Field and Description |
|---|---|
protected com.fasterxml.jackson.databind.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.hibernate.engine.spi.Mapping |
_mapping |
protected boolean |
_nullMissingEntities |
protected com.fasterxml.jackson.databind.BeanProperty |
_property
Property that has proxy value to handle
|
protected boolean |
_serializeIdentifier |
| Constructor and Description |
|---|
HibernateProxySerializer(boolean forceLazyLoading) |
HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier) |
HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
boolean nullMissingEntities,
org.hibernate.engine.spi.Mapping mapping) |
HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
boolean nullMissingEntities,
org.hibernate.engine.spi.Mapping mapping,
com.fasterxml.jackson.databind.BeanProperty property) |
HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
org.hibernate.engine.spi.Mapping mapping) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor,
com.fasterxml.jackson.databind.JavaType typeHint) |
com.fasterxml.jackson.databind.JsonSerializer<?> |
createContextual(com.fasterxml.jackson.databind.SerializerProvider prov,
com.fasterxml.jackson.databind.BeanProperty property) |
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 com.fasterxml.jackson.databind.JsonSerializer<Object> |
findSerializer(com.fasterxml.jackson.databind.SerializerProvider provider,
Object value) |
boolean |
isEmpty(com.fasterxml.jackson.databind.SerializerProvider provider,
org.hibernate.proxy.HibernateProxy value) |
void |
serialize(org.hibernate.proxy.HibernateProxy value,
com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.databind.SerializerProvider provider) |
void |
serializeWithType(org.hibernate.proxy.HibernateProxy value,
com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.databind.SerializerProvider provider,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) |
protected final com.fasterxml.jackson.databind.BeanProperty _property
protected final boolean _forceLazyLoading
protected final boolean _serializeIdentifier
protected final boolean _nullMissingEntities
protected final org.hibernate.engine.spi.Mapping _mapping
protected com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap _dynamicSerializers
public HibernateProxySerializer(boolean forceLazyLoading)
public HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier)
public HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
org.hibernate.engine.spi.Mapping mapping)
public HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
boolean nullMissingEntities,
org.hibernate.engine.spi.Mapping mapping)
public HibernateProxySerializer(boolean forceLazyLoading,
boolean serializeIdentifier,
boolean nullMissingEntities,
org.hibernate.engine.spi.Mapping mapping,
com.fasterxml.jackson.databind.BeanProperty property)
public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov,
com.fasterxml.jackson.databind.BeanProperty property)
createContextual in interface com.fasterxml.jackson.databind.ser.ContextualSerializerpublic boolean isEmpty(com.fasterxml.jackson.databind.SerializerProvider provider,
org.hibernate.proxy.HibernateProxy value)
isEmpty in class com.fasterxml.jackson.databind.JsonSerializer<org.hibernate.proxy.HibernateProxy>public void serialize(org.hibernate.proxy.HibernateProxy value,
com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.databind.SerializerProvider provider)
throws IOException
serialize in class com.fasterxml.jackson.databind.JsonSerializer<org.hibernate.proxy.HibernateProxy>IOExceptionpublic void serializeWithType(org.hibernate.proxy.HibernateProxy value,
com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.databind.SerializerProvider provider,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer)
throws IOException
serializeWithType in class com.fasterxml.jackson.databind.JsonSerializer<org.hibernate.proxy.HibernateProxy>IOExceptionpublic void acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor,
com.fasterxml.jackson.databind.JavaType typeHint)
throws com.fasterxml.jackson.databind.JsonMappingException
acceptJsonFormatVisitor in interface com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitableacceptJsonFormatVisitor in class com.fasterxml.jackson.databind.JsonSerializer<org.hibernate.proxy.HibernateProxy>com.fasterxml.jackson.databind.JsonMappingExceptionprotected com.fasterxml.jackson.databind.JsonSerializer<Object> findSerializer(com.fasterxml.jackson.databind.SerializerProvider provider, Object value) throws IOException
IOExceptionprotected Object findProxied(org.hibernate.proxy.HibernateProxy proxy)
Copyright © 2020 FasterXML. All rights reserved.