public class SimpleResourceAssembler<T> extends Object implements org.springframework.hateoas.server.RepresentationModelAssembler<T,org.springframework.hateoas.EntityModel<T>>, ResourcesAssembler<T,org.springframework.hateoas.EntityModel<T>>
ResourceAssembler
/ResourcesAssembler
that focuses purely on the domain type,
returning back Resource
and Resources
for that type instead of
org.springframework.hateoas.ResourceSupport
.Constructor and Description |
---|
SimpleResourceAssembler() |
Modifier and Type | Method and Description |
---|---|
protected void |
addLinks(org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<T>> resources)
Define links to add to the
Resources collection. |
protected void |
addLinks(org.springframework.hateoas.EntityModel<T> resource)
Define links to add to every individual
Resource . |
org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<T>> |
toCollectionModel(Iterable<? extends T> entities)
Converts all given entities into resources and wraps the collection as a resource as well.
|
org.springframework.hateoas.EntityModel<T> |
toModel(T entity)
Converts the given entity into a
Resource . |
public org.springframework.hateoas.EntityModel<T> toModel(T entity)
Resource
.public org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<T>> toCollectionModel(Iterable<? extends T> entities)
toCollectionModel
in interface ResourcesAssembler<T,org.springframework.hateoas.EntityModel<T>>
toCollectionModel
in interface org.springframework.hateoas.server.RepresentationModelAssembler<T,org.springframework.hateoas.EntityModel<T>>
entities
- must not be null.Resources
containing Resource
of T
.toModel(Object)
protected void addLinks(org.springframework.hateoas.EntityModel<T> resource)
Resource
.resource
- protected void addLinks(org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<T>> resources)
Resources
collection.resources
- Copyright © 2020 Pivotal Software, Inc.. All rights reserved.