@groovy.transform.CompileStatic class DefaultHalViewHelper extends java.lang.Object
Helps creating HAL links
Modifiers | Name | Description |
---|---|---|
static class |
DefaultHalViewHelper.HalStreamingJsonDelegate |
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
EMBEDDED_ATTRIBUTE |
|
static java.lang.String |
EMBEDDED_PARAMETER |
|
static java.lang.String |
HREFLANG_ATTRIBUTE |
|
static java.lang.String |
HREF_ATTRIBUTE |
|
static java.lang.String |
LINKS_ATTRIBUTE |
|
static java.lang.String |
SELF_ATTRIBUTE |
|
static java.lang.String |
TYPE_ATTRIBUTE |
Type | Name and description |
---|---|
java.lang.String |
contentType |
JsonView |
view |
GrailsJsonViewHelper |
viewHelper |
Constructor and description |
---|
DefaultHalViewHelper
(JsonView view, GrailsJsonViewHelper viewHelper) |
Type | Name and description |
---|---|
protected java.util.Map<java.lang.String, java.lang.Object> |
buildPaginateParams(java.lang.Integer max, java.lang.Integer offset, java.lang.String sort, java.lang.String order) |
protected groovy.lang.Closure<java.lang.Void> |
createlinksRenderingClosure(java.util.Map<java.lang.String, java.lang.Object> arguments = [:]) |
void |
embedded(java.lang.Object object, java.util.Map arguments = [:]) Renders embedded associations for the given entity |
void |
embedded(java.util.Map model) Render the given embedded objects |
void |
embedded(groovy.lang.Closure callable) Outputs a HAL embedded entry for the given closure |
void |
embedded(java.lang.String contentType, groovy.lang.Closure callable) Outputs a HAL embedded entry for the content type and closure |
protected java.lang.Integer |
getLastOffset(java.lang.Integer total, java.lang.Integer max) |
protected java.lang.Integer |
getNextOffset(java.lang.Integer total, java.lang.Integer offset, java.lang.Integer max) |
protected java.util.List<Link> |
getPaginationLinks(java.lang.Object object, java.lang.Integer total, java.lang.Integer max, java.lang.Integer offset, java.lang.String sort, java.lang.String order) @return the pagination links if any |
protected java.lang.Integer |
getPrevOffset(java.lang.Integer offset, java.lang.Integer max) |
void |
inline(java.lang.Object object, java.util.Map arguments = [:], groovy.lang.Closure customizer = null) |
void |
inline(java.lang.Object object, groovy.lang.Closure customizer) |
void |
links(groovy.lang.Closure callable) Define the hal links |
void |
links(java.lang.Object object, java.lang.String contentType = this.contentType) Creates HAL links for the given object |
void |
links(java.util.Map model, java.lang.Object paginationObject, java.lang.Number total, java.lang.String contentType = this.contentType) |
void |
links(java.util.Map model, java.lang.String contentType = this.contentType) |
void |
paginate(java.lang.Object object, java.lang.Integer total, java.lang.Integer offset = null, java.lang.Integer max = null, java.lang.String sort = null, java.lang.String order = null) Pagination support which outputs hal links to the resulting pages |
protected java.util.Map<java.lang.String, java.lang.Object> |
paramsWithOffset(java.util.Map<java.lang.String, java.lang.Object> originalParameters, java.lang.Integer offset) Creates a new Parameter map with the new offset Note: neccesary to avoid clone until Groovy 2.5.x https://issues.apache.org/jira/browse/GROOVY-7325 |
JsonWritable |
render(java.lang.Object object, java.util.Map arguments, groovy.lang.Closure customizer) Same as GrailsJsonViewHelper#render(java.lang.Object, java.util.Map, groovy.lang.Closure) but renders HAL links too |
JsonWritable |
render(java.lang.Object object, java.util.Map arguments) |
JsonWritable |
render(java.lang.Object object, groovy.lang.Closure customizer) Same as GrailsJsonViewHelper#render(java.lang.Object, java.util.Map, groovy.lang.Closure) but renders HAL links too |
JsonWritable |
render(java.lang.Object object) |
protected void |
renderEntityProperties(org.grails.datastore.mapping.model.PersistentEntity entity, java.lang.Object instance, org.grails.datastore.mapping.reflect.EntityReflector entityReflector, StreamingJsonDelegate associationJsonDelegate) |
protected void |
renderProperty(java.lang.Object embeddedObject, org.grails.datastore.mapping.model.PersistentProperty prop, org.grails.datastore.mapping.reflect.EntityReflector associationReflector, StreamingJsonDelegate jsonDelegate) |
void |
setDelegate(StreamingJsonDelegate jsonDelegate) |
void |
type(java.lang.String name) @param name Sets the HAL response type |
protected void |
writeLinks(StreamingJsonDelegate jsonDelegate, java.lang.Object object, java.lang.String contentType) |
Methods inherited from class | Name |
---|---|
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() |
Renders embedded associations for the given entity
object
- The objectarguments
- Any arguments. Supported arguments: 'includes', 'excludes', 'deep'Render the given embedded objects
model
- The embedded modelOutputs a HAL embedded entry for the given closure
callable
- The callableOutputs a HAL embedded entry for the content type and closure
callable
- The callable
Define the hal links
callable
- The closureCreates HAL links for the given object
object
- The object to create links forPagination support which outputs hal links to the resulting pages
object
- The object to create links fortotal
- The total number of objects to be paginatedoffset
- The numerical offset where the page starts (defaults to 0)max
- The maximum number of objects to be shown (defaults to 10)sort
- The field to sort on (defaults to null)order
- The order in which the results are to be sorted eg: DESC or ASCCreates a new Parameter map with the new offset Note: neccesary to avoid clone until Groovy 2.5.x https://issues.apache.org/jira/browse/GROOVY-7325
map
- The parameter map to copyoffset
- The new offset to useSame as GrailsJsonViewHelper#render(java.lang.Object, java.util.Map, groovy.lang.Closure) but renders HAL links too
Same as GrailsJsonViewHelper#render(java.lang.Object, java.util.Map, groovy.lang.Closure) but renders HAL links too
name
- Sets the HAL response typeGroovy Documentation