Spring Hateoas

org.springframework.hateoas.hal
Class Jackson2HalModule.HalResourcesSerializer

java.lang.Object
  extended by com.fasterxml.jackson.databind.JsonSerializer<T>
      extended by com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
          extended by com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>
              extended by org.springframework.hateoas.hal.Jackson2HalModule.HalResourcesSerializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable, com.fasterxml.jackson.databind.jsonschema.SchemaAware, com.fasterxml.jackson.databind.ser.ContextualSerializer
Enclosing class:
Jackson2HalModule

public static class Jackson2HalModule.HalResourcesSerializer
extends com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>
implements com.fasterxml.jackson.databind.ser.ContextualSerializer

Custom JsonSerializer to render Resource-Lists in HAL compatible JSON. Renders the list as a Map.

Author:
Alexander Baetz, Oliver Gierke

Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None
 
Field Summary
 
Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType
 
Constructor Summary
Jackson2HalModule.HalResourcesSerializer(com.fasterxml.jackson.databind.BeanProperty property, RelProvider relProvider, boolean enforceEmbeddedCollections)
           
Jackson2HalModule.HalResourcesSerializer(RelProvider relPorvider, boolean enforceEmbeddedCollections)
           
 
Method Summary
protected  com.fasterxml.jackson.databind.ser.ContainerSerializer<?> _withValueTypeSerializer(com.fasterxml.jackson.databind.jsontype.TypeSerializer vts)
           
 com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property)
           
 com.fasterxml.jackson.databind.JsonSerializer<?> getContentSerializer()
           
 com.fasterxml.jackson.databind.JavaType getContentType()
           
 boolean hasSingleElement(Collection<?> value)
           
 boolean isEmpty(Collection<?> value)
           
 void serialize(Collection<?> value, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider)
           
 
Methods inherited from class com.fasterxml.jackson.databind.ser.ContainerSerializer
hasContentTypeAnnotation, withValueTypeSerializer
 
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
acceptJsonFormatVisitor, createObjectNode, createSchemaNode, createSchemaNode, findConvertingContentSerializer, findPropertyFilter, getSchema, getSchema, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow
 
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isUnwrappingSerializer, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jackson2HalModule.HalResourcesSerializer

public Jackson2HalModule.HalResourcesSerializer(RelProvider relPorvider,
                                                boolean enforceEmbeddedCollections)

Jackson2HalModule.HalResourcesSerializer

public Jackson2HalModule.HalResourcesSerializer(com.fasterxml.jackson.databind.BeanProperty property,
                                                RelProvider relProvider,
                                                boolean enforceEmbeddedCollections)
Method Detail

serialize

public void serialize(Collection<?> value,
                      com.fasterxml.jackson.core.JsonGenerator jgen,
                      com.fasterxml.jackson.databind.SerializerProvider provider)
               throws IOException,
                      com.fasterxml.jackson.core.JsonGenerationException
Specified by:
serialize in class com.fasterxml.jackson.databind.ser.std.StdSerializer<Collection<?>>
Throws:
IOException
com.fasterxml.jackson.core.JsonGenerationException

createContextual

public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov,
                                                                         com.fasterxml.jackson.databind.BeanProperty property)
                                                                  throws com.fasterxml.jackson.databind.JsonMappingException
Specified by:
createContextual in interface com.fasterxml.jackson.databind.ser.ContextualSerializer
Throws:
com.fasterxml.jackson.databind.JsonMappingException

getContentType

public com.fasterxml.jackson.databind.JavaType getContentType()
Specified by:
getContentType in class com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>

getContentSerializer

public com.fasterxml.jackson.databind.JsonSerializer<?> getContentSerializer()
Specified by:
getContentSerializer in class com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>

isEmpty

public boolean isEmpty(Collection<?> value)
Specified by:
isEmpty in class com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>

hasSingleElement

public boolean hasSingleElement(Collection<?> value)
Specified by:
hasSingleElement in class com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>

_withValueTypeSerializer

protected com.fasterxml.jackson.databind.ser.ContainerSerializer<?> _withValueTypeSerializer(com.fasterxml.jackson.databind.jsontype.TypeSerializer vts)
Specified by:
_withValueTypeSerializer in class com.fasterxml.jackson.databind.ser.ContainerSerializer<Collection<?>>

Spring Hateoas

Copyright © 2012-2014–2014 Pivotal, Inc.. All rights reserved.