public abstract class ResourceAssemblerSupport<T,D extends ResourceSupport> extends Object implements ResourceAssembler<T,D>
ResourceAssembler
s. Will automate ResourceSupport
instance creation and make
sure a self-link is always added.Constructor and Description |
---|
ResourceAssemblerSupport(Class<?> controllerClass,
Class<D> resourceType)
Creates a new
ResourceAssemblerSupport using the given controller class and resource type. |
Modifier and Type | Method and Description |
---|---|
protected D |
createResourceWithId(Object id,
T entity)
Creates a new resource with a self link to the given id.
|
protected D |
createResourceWithId(Object id,
T entity,
Object... parameters) |
protected D |
instantiateResource(T entity)
Instantiates the resource object.
|
List<D> |
toResources(Iterable<? extends T> entities)
Converts all given entities into resources.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toResource
public ResourceAssemblerSupport(Class<?> controllerClass, Class<D> resourceType)
ResourceAssemblerSupport
using the given controller class and resource type.controllerClass
- must not be null.resourceType
- must not be null.public List<D> toResources(Iterable<? extends T> entities)
entities
- must not be null.ResourceAssembler.toResource(Object)
protected D createResourceWithId(Object id, T entity)
entity
- must not be null.id
- must not be null.protected D instantiateResource(T entity)
entity
- Copyright © 2012-2015–2015 Pivotal, Inc.. All rights reserved.