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

public class PersistentEntityResource extends org.springframework.hateoas.EntityModel<Object>
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

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder to create PersistentEntityResource instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    build(Object content, org.springframework.data.mapping.PersistentEntity<?,?> entity)
    Creates a new PersistentEntityResource.Builder to create PersistentEntityResources 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 the PersistentEntity for the underlying instance.
    org.springframework.data.mapping.PersistentPropertyAccessor<?>
    Returns the PersistentPropertyAccessor for the underlying content bean.
    Returns the underlying instance.
    boolean
     
    boolean
    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 the PersistentEntity for the underlying instance.
      Returns:
    • getTarget

      public Object getTarget()
      Returns the underlying instance. If the instance is a TargetAware, the TargetAware's target is returned.
      Returns:
      See Also:
      • EntityModel.getContent()
    • getPropertyAccessor

      public org.springframework.data.mapping.PersistentPropertyAccessor<?> getPropertyAccessor()
      Returns the PersistentPropertyAccessor for the underlying content bean.
      Returns:
    • getEmbeddeds

      public Iterable<org.springframework.hateoas.server.core.EmbeddedWrapper> 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 new PersistentEntityResource.Builder to create PersistentEntityResources eventually.
      Parameters:
      content - must not be null.
      entity - must not be null.
      Returns: