Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## grails.rest.render.hal
[Groovy] Class HalJsonRenderer

    java.lang.Object
      grails.rest.render.AbstractRenderer
          grails.rest.render.AbstractIncludeExcludeRenderer
              grails.rest.render.util.AbstractLinkingRenderer
                  grails.rest.render.hal.HalJsonRenderer

    @groovy.transform.CompileStatic
    class HalJsonRenderer
    extends AbstractLinkingRenderer

Renders domain instances in HAL JSON format (see http://tools.ietf.org/html/draft-kelly-json-hal-05)

Authors:
  Graeme Rocher

Since:
  2.3

Field Summary
`static java.lang.String` | `EMBEDDED_ATTRIBUTE`
`static java.lang.String` | `LINKS_ATTRIBUTE`
`static MimeType` | `MIME_TYPE`

Fields inherited from class AbstractLinkingRenderer
DEFAULT_EXCLUDES, DEPRECATED_ATTRIBUTE, HREFLANG_ATTRIBUTE, HREF_ATTRIBUTE, RELATIONSHIP_SELF, TEMPLATED_ATTRIBUTE, TITLE_ATTRIBUTE, TYPE_ATTRIBUTE

Property Summary
`DataBindingSourceRegistry` | `dataBindingSourceRegistry`
`org.springframework.core.convert.converter.Converter` | `dateToStringConverter`

Constructor Summary
`HalJsonRenderer(java.lang.Class targetType)`
`HalJsonRenderer(java.lang.Class targetType, MimeType... mimeTypes)`

Method Summary
`protected void` | `beginLinks(com.google.gson.stream.JsonWriter writer)`
`void` | `initialize()`
`protected java.lang.Object` | `renderEmbeddedAttributes(com.google.gson.stream.JsonWriter writer, java.lang.Object object, RenderContext context, MimeType mimeType)`
`void` | `renderInternal(java.lang.Object object, RenderContext context)`
`void` | `setDateToStringConverter(org.springframework.core.convert.converter.Converter converter)`
`void` | `setGson(com.google.gson.Gson gson)`
`protected void` | `writeDomainProperty(java.lang.Object value, java.lang.String propertyName, java.lang.Object writer)`
`protected void` | `writeDomainWithEmbeddedAndLinks(RenderContext context, java.lang.Class clazz, java.lang.Object object, com.google.gson.stream.JsonWriter writer, java.util.Locale locale, MimeType contentType, java.util.Set writtenObjects, java.util.Stack referenceStack)`
`protected void` | `writeLink(Link link, java.util.Locale locale, java.lang.Object writerObject)`
`protected void` | `writeLinkForCurrentPath(RenderContext context, MimeType mimeType, com.google.gson.stream.JsonWriter writer)`
`protected java.util.Map` | `writeLinks(RenderContext context, groovy.lang.MetaClass metaClass, java.lang.Object object, org.grails.datastore.mapping.model.PersistentEntity entity, java.util.Locale locale, MimeType contentType, com.google.gson.stream.JsonWriter writer, boolean associationLinks = true)`
`protected void` | `writeSimpleObject(java.lang.Object object, RenderContext context, com.google.gson.stream.JsonWriter writer)`
`protected java.lang.Object` | `writeSimpleObjectAndLink(java.lang.Object o, RenderContext context, com.google.gson.stream.JsonWriter writer, MimeType mimeType)`

Methods inherited from class AbstractLinkingRenderer
getLinkTitle, getLinksForObject, getResourceTitle, isDomainResource, render, renderInternal, writeAssociationLinks, writeDomain, writeDomainProperty, writeExtraLinks, writeLink

Methods inherited from class AbstractIncludeExcludeRenderer
excludesProperty, includesProperty, shouldIncludeProperty

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### EMBEDDED_ATTRIBUTE

    public static final java.lang.String EMBEDDED_ATTRIBUTE

### LINKS_ATTRIBUTE

    public static final java.lang.String LINKS_ATTRIBUTE

### MIME_TYPE

    public static final MimeType MIME_TYPE

Property Detail

### dataBindingSourceRegistry

    @org.springframework.beans.factory.annotation.Autowired(required = false)
    DataBindingSourceRegistry dataBindingSourceRegistry

### dateToStringConverter

    org.springframework.core.convert.converter.Converter dateToStringConverter

Constructor Detail

### HalJsonRenderer

    HalJsonRenderer(java.lang.Class targetType)

### HalJsonRenderer

    HalJsonRenderer(java.lang.Class targetType, MimeType... mimeTypes)

Method Detail

### beginLinks

    protected void beginLinks(com.google.gson.stream.JsonWriter writer)

### initialize

    @javax.annotation.PostConstruct
    void initialize()

### renderEmbeddedAttributes

    protected java.lang.Object renderEmbeddedAttributes(com.google.gson.stream.JsonWriter writer, java.lang.Object object, RenderContext context, MimeType mimeType)

### renderInternal

    @java.lang.Override
    void renderInternal(java.lang.Object object, RenderContext context)

### setDateToStringConverter

    @org.springframework.beans.factory.annotation.Autowired(required = false)
    void setDateToStringConverter(org.springframework.core.convert.converter.Converter converter)

### setGson

    @org.springframework.beans.factory.annotation.Autowired(required = false)
    void setGson(com.google.gson.Gson gson)

### writeDomainProperty

    protected void writeDomainProperty(java.lang.Object value, java.lang.String propertyName, java.lang.Object writer)

### writeDomainWithEmbeddedAndLinks

    protected void writeDomainWithEmbeddedAndLinks(RenderContext context, java.lang.Class clazz, java.lang.Object object, com.google.gson.stream.JsonWriter writer, java.util.Locale locale, MimeType contentType, java.util.Set writtenObjects, java.util.Stack referenceStack)

### writeLink

    protected void writeLink(Link link, java.util.Locale locale, java.lang.Object writerObject)

### writeLinkForCurrentPath

    protected void writeLinkForCurrentPath(RenderContext context, MimeType mimeType, com.google.gson.stream.JsonWriter writer)

### writeLinks

    protected java.util.Map writeLinks(RenderContext context, groovy.lang.MetaClass metaClass, java.lang.Object object, org.grails.datastore.mapping.model.PersistentEntity entity, java.util.Locale locale, MimeType contentType, com.google.gson.stream.JsonWriter writer, boolean associationLinks = true)

### writeSimpleObject

    protected void writeSimpleObject(java.lang.Object object, RenderContext context, com.google.gson.stream.JsonWriter writer)

### writeSimpleObjectAndLink

    protected java.lang.Object writeSimpleObjectAndLink(java.lang.Object o, RenderContext context, com.google.gson.stream.JsonWriter writer, MimeType mimeType)

Groovy Documentation