public abstract class RepresentationModelAssemblerSupport<T,D extends RepresentationModel<?>> 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 Class<?> |
getControllerClass() |
protected Class<D> |
getResourceType() |
protected D |
instantiateModel(T entity)
Instantiates the resource object.
|
org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport.Builder<T,D> |
map(Iterable<? extends T> entities)
Maps the given
Iterable of entities to either a CollectionModel or simple List of
RepresentationModels. |
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<?>>entities - must not be null.CollectionModel containing D.public org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport.Builder<T,D> map(Iterable<? extends T> entities)
Iterable of entities to either a CollectionModel or simple List of
RepresentationModels.entities - must not be null.protected D createModelWithId(Object id, T entity)
entity - must not be null.id - must not be null.protected Class<?> getControllerClass()
protected D instantiateModel(T entity)
entity - Copyright © 2011–2021 Pivotal, Inc.. All rights reserved.