public class HalRepresentation extends Object
It's a resource object with two reserved properties:
GET /orders/523 HTTP/1.1
Host: example.org
Accept: application/hal+json
HTTP/1.1 200 OK
Content-Type: application/hal+json
{
"_links": {
"self": { "href": "/orders/523" },
"warehouse": { "href": "/warehouse/56" },
"invoice": { "href": "/invoices/873" }
},
"currency": "USD",
"status": "shipped",
"total": 10.20
}
| Constructor and Description |
|---|
HalRepresentation()
Default constructor required by Jackson.
|
| Modifier and Type | Method and Description |
|---|---|
HalRepresentation |
embedded(String rel,
Object embedded)
Adds an embedded resource or array of resources.
|
Map<String,Object> |
getEmbedded()
Returns the embedded resources.
|
Object |
getLink(String rel)
Returns the resource's links.
|
Map<String,Object> |
getLinks()
Returns the resource's links.
|
HalRepresentation |
link(String rel,
Link link)
Adds a link with the specified rel and link representation.
|
HalRepresentation |
link(String rel,
String href)
Adds a link with the specified rel and href.
|
HalRepresentation |
self(Link link)
Adds the self link.
|
HalRepresentation |
self(String href)
Adds the self link.
|
public HalRepresentation()
public HalRepresentation self(String href)
href - the resource hrefpublic HalRepresentation self(Link link)
link - the linkpublic HalRepresentation link(String rel, String href)
rel - the relhref - the hrefpublic HalRepresentation link(String rel, Link link)
rel - the rellink - the link representationpublic HalRepresentation embedded(String rel, Object embedded)
rel - the relation typeembedded - the resource (can be an array of resources)Copyright © 2013-2018–2019 SeedStack. All rights reserved.