Spring Hateoas

org.springframework.hateoas.hal
Class Jackson2HalModule.HalLinkListSerializer

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<List<Link>>
              extended by org.springframework.hateoas.hal.Jackson2HalModule.HalLinkListSerializer
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.HalLinkListSerializer
extends com.fasterxml.jackson.databind.ser.ContainerSerializer<List<Link>>
implements com.fasterxml.jackson.databind.ser.ContextualSerializer

Custom JsonSerializer to render Link instances in HAL compatible JSON.

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.HalLinkListSerializer(com.fasterxml.jackson.databind.BeanProperty property, CurieProvider curieProvider)
           
Jackson2HalModule.HalLinkListSerializer(CurieProvider curieProvider)
           
 
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 provider, com.fasterxml.jackson.databind.BeanProperty property)
           
 com.fasterxml.jackson.databind.JsonSerializer<?> getContentSerializer()
           
 com.fasterxml.jackson.databind.JavaType getContentType()
           
 boolean hasSingleElement(List<Link> value)
           
 boolean isEmpty(List<Link> value)
           
 void serialize(List<Link> 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.HalLinkListSerializer

public Jackson2HalModule.HalLinkListSerializer(CurieProvider curieProvider)

Jackson2HalModule.HalLinkListSerializer

public Jackson2HalModule.HalLinkListSerializer(com.fasterxml.jackson.databind.BeanProperty property,
                                               CurieProvider curieProvider)
Method Detail

serialize

public void serialize(List<Link> 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<List<Link>>
Throws:
IOException
com.fasterxml.jackson.core.JsonGenerationException

createContextual

public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider provider,
                                                                         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<List<Link>>

getContentSerializer

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

isEmpty

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

hasSingleElement

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

_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<List<Link>>

Spring Hateoas

Copyright © 2012-2014-2014 Pivotal, Inc.. All Rights Reserved.