Class PersistentEntityResource
java.lang.Object
org.springframework.hateoas.RepresentationModel<org.springframework.hateoas.EntityModel<T>>
org.springframework.hateoas.EntityModel<Object>
org.springframework.data.rest.webmvc.PersistentEntityResource
A Spring HATEOAS
EntityModel
subclass that holds a reference to the entity's PersistentEntity
metadata.- Author:
- Jon Brisbin, Oliver Gierke, Dario Seidl
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder to createPersistentEntityResource
instances. -
Method Summary
Modifier and TypeMethodDescriptionCreates a newPersistentEntityResource.Builder
to createPersistentEntityResource
s eventually.Iterable<org.springframework.hateoas.server.core.EmbeddedWrapper>
Returns the resources that are supposed to be rendered in the_embedded
clause.org.springframework.data.mapping.PersistentEntity<?,
? extends org.springframework.data.mapping.PersistentProperty<?>> Returns thePersistentEntity
for the underlying instance.org.springframework.data.mapping.PersistentPropertyAccessor<?>
Returns thePersistentPropertyAccessor
for the underlying content bean.Returns the underlying instance.boolean
isNested()
boolean
isNew()
Returns whether the content of the resource is a new entity about to be created.Methods inherited from class org.springframework.hateoas.EntityModel
equals, getContent, hashCode, of, of, of, toString
Methods inherited from class org.springframework.hateoas.RepresentationModel
add, add, add, addAllIf, addIf, getLink, getLink, getLinks, getLinks, getLinks, getRequiredLink, getRequiredLink, hasLink, hasLink, hasLinks, mapLink, mapLinkIf, removeLinks
-
Method Details
-
isNew
public boolean isNew()Returns whether the content of the resource is a new entity about to be created. Used to distinguish between creation and updates for incoming requests.- Returns:
-
isNested
public boolean isNested() -
getPersistentEntity
public org.springframework.data.mapping.PersistentEntity<?,? extends org.springframework.data.mapping.PersistentProperty<?>> getPersistentEntity()Returns thePersistentEntity
for the underlying instance.- Returns:
-
getTarget
Returns the underlying instance. If the instance is aTargetAware
, theTargetAware
's target is returned.- Returns:
- See Also:
-
EntityModel.getContent()
-
getPropertyAccessor
public org.springframework.data.mapping.PersistentPropertyAccessor<?> getPropertyAccessor()Returns thePersistentPropertyAccessor
for the underlying content bean.- Returns:
-
getEmbeddeds
Returns the resources that are supposed to be rendered in the_embedded
clause.- Returns:
- the embeddeds
-
build
public static PersistentEntityResource.Builder build(Object content, org.springframework.data.mapping.PersistentEntity<?, ?> entity) Creates a newPersistentEntityResource.Builder
to createPersistentEntityResource
s eventually.- Parameters:
content
- must not be null.entity
- must not be null.- Returns:
-