Package org.springframework.hateoas
Class EntityModel<T>
java.lang.Object
org.springframework.hateoas.RepresentationModel<EntityModel<T>>
org.springframework.hateoas.EntityModel<T>
A simple
EntityModel
wrapping a domain object and adding links to it.- Author:
- Oliver Gierke, Greg Turnquist
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates an emptyEntityModel
.protected
EntityModel
(T content) protected
EntityModel
(T content, Iterable<Link> links) Creates a newEntityModel
with the given content andLink
s. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the underlying entity.int
hashCode()
static <T> EntityModel<T>
of
(T content) Creates a newEntityModel
with the given content.static <T> EntityModel<T>
Creates a newEntityModel
with the given content andLink
s.static <T> EntityModel<T>
Creates a newEntityModel
with the given content andLink
s (optional).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
-
Constructor Details
-
EntityModel
protected EntityModel()Creates an emptyEntityModel
. -
EntityModel
-
EntityModel
Creates a newEntityModel
with the given content andLink
s.- Parameters:
content
- must not be null.links
- the links to add to theEntityModel
.
-
-
Method Details
-
of
Creates a newEntityModel
with the given content.- Parameters:
content
- must not be null.- Returns:
- Since:
- 1.1
-
of
Creates a newEntityModel
with the given content andLink
s (optional).- Parameters:
content
- must not be null.links
- the links to add to theEntityModel
.- Returns:
- Since:
- 1.1
-
of
Creates a newEntityModel
with the given content andLink
s.- Parameters:
content
- must not be null.links
- the links to add to theEntityModel
.- Returns:
- Since:
- 1.1
-
getContent
Returns the underlying entity.- Returns:
- the content
-
toString
- Overrides:
toString
in classRepresentationModel<EntityModel<T>>
-
equals
- Overrides:
equals
in classRepresentationModel<EntityModel<T>>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classRepresentationModel<EntityModel<T>>
-