Package io.jenkins.blueocean.rest.hal
Class Links
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Link>
-
- io.jenkins.blueocean.rest.hal.Links
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Link>
public final class Links extends HashMap<String,Link>
Implementation of JSON Hypertext application language (HAL).- Only _links element is implemented
- Only required href element is supported
- TODO: decide on whether application/hal+json or just use application/json
Resource
implementation can add their resource specific path by callingadd(String, Link)
Example:{ "_links":{ "self":{"href":"http://.../pipelines/1/runs/23"}, "test":{"href":"http://.../pipelines/1/runs/23/test"} } }
- Author:
- Vivek Pandey
- See Also:
Link
,Resource
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Links
add(String ref)
Add a new link with key 'ref' and href being self.href+refLinks
add(String ref, Link link)
static String
ensureTrailingSlash(String path)
Link
self()
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
Links
public Links(Resource self)
-
-
Method Detail
-
self
public Link self()
-
add
public Links add(String ref)
Add a new link with key 'ref' and href being self.href+reflinks.add("testResult"); { "_links":[ { "self":{"href":"/organizations/jenkins/pipelines/p1/runs/2/"}, "testResult":{"href":"/organizations/jenkins/pipelines/p1/runs/2/testResult"}, } ] }
- Parameters:
ref
- relative path to be added as newLink
relative to 'self''s href- Returns:
- this Links instance
-
-