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
ConstructorsModifierConstructorDescriptionprotectedCreates an emptyEntityModel.protectedEntityModel(T content) protectedEntityModel(T content, Iterable<Link> links) Creates a newEntityModelwith the given content andLinks. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the underlying entity.inthashCode()static <T> EntityModel<T>of(T content) Creates a newEntityModelwith the given content.static <T> EntityModel<T>Creates a newEntityModelwith the given content andLinks.static <T> EntityModel<T>Creates a newEntityModelwith the given content andLinks (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 newEntityModelwith the given content andLinks.- Parameters:
content- must not be null.links- the links to add to theEntityModel.
-
-
Method Details
-
of
Creates a newEntityModelwith the given content.- Parameters:
content- must not be null.- Returns:
- Since:
- 1.1
-
of
Creates a newEntityModelwith the given content andLinks (optional).- Parameters:
content- must not be null.links- the links to add to theEntityModel.- Returns:
- Since:
- 1.1
-
of
Creates a newEntityModelwith the given content andLinks.- 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:
toStringin classRepresentationModel<EntityModel<T>>
-
equals
- Overrides:
equalsin classRepresentationModel<EntityModel<T>>
-
hashCode
public int hashCode()- Overrides:
hashCodein classRepresentationModel<EntityModel<T>>
-