public abstract class RepresentationModelAssemblerSupport<T,D extends RepresentationModel<D>> extends Object implements RepresentationModelAssembler<T,D>
RepresentationModelAssemblers. Will automate RepresentationModel instance
creation and make sure a self-link is always added.| Constructor and Description |
|---|
RepresentationModelAssemblerSupport(Class<?> controllerClass,
Class<D> resourceType)
Creates a new
RepresentationModelAssemblerSupport using the given controller class and resource type. |
| Modifier and Type | Method and Description |
|---|---|
protected D |
createModelWithId(Object id,
T entity)
Creates a new resource with a self link to the given id.
|
protected D |
createModelWithId(Object id,
T entity,
Object... parameters) |
protected D |
instantiateModel(T entity)
Instantiates the resource object.
|
org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport.Builder<T,D> |
map(Iterable<? extends T> entities) |
CollectionModel<D> |
toCollectionModel(Iterable<? extends T> entities)
Converts an
Iterable or Ts into an Iterable of RepresentationModel and wraps them
in a CollectionModel instance. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoModelpublic RepresentationModelAssemblerSupport(Class<?> controllerClass, Class<D> resourceType)
RepresentationModelAssemblerSupport using the given controller class and resource type.controllerClass - must not be null.resourceType - must not be null.public CollectionModel<D> toCollectionModel(Iterable<? extends T> entities)
RepresentationModelAssemblerIterable or Ts into an Iterable of RepresentationModel and wraps them
in a CollectionModel instance.toCollectionModel in interface RepresentationModelAssembler<T,D extends RepresentationModel<D>>entities - must not be null.CollectionModel containing D.public org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport.Builder<T,D> map(Iterable<? extends T> entities)
protected D createModelWithId(Object id, T entity)
entity - must not be null.id - must not be null.protected D instantiateModel(T entity)
entity - Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.