public class JsonPathLinkDiscoverer extends Object implements LinkDiscoverer
LinkDiscoverer that uses JsonPath to find links inside a representation.| Constructor and Description |
|---|
JsonPathLinkDiscoverer(String pathTemplate,
MediaType... mediaTypes)
Creates a new
JsonPathLinkDiscoverer using the given path template supporting the given MediaType. |
| Modifier and Type | Method and Description |
|---|---|
protected Link |
extractLink(Object element,
LinkRelation rel)
Callback for each
LinkDiscoverer to extract relevant attributes and generate a Link. |
Links |
findLinksWithRel(LinkRelation relation,
InputStream representation)
Returns all links with the given
LinkRelation found in the given InputStream representation. |
Links |
findLinksWithRel(LinkRelation relation,
String representation)
Returns all links with the given
LinkRelation found in the given String representation. |
Optional<Link> |
findLinkWithRel(LinkRelation relation,
InputStream representation)
Finds a single link with the given
LinkRelation in the given InputStream representation. |
Optional<Link> |
findLinkWithRel(LinkRelation relation,
String representation)
Finds a single link with the given
LinkRelation in the given String representation. |
boolean |
supports(MediaType delimiter) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindLinksWithRel, findLinksWithRel, findLinkWithRel, findLinkWithRel, findRequiredLinkWithRel, findRequiredLinkWithRelpublic JsonPathLinkDiscoverer(String pathTemplate, MediaType... mediaTypes)
JsonPathLinkDiscoverer using the given path template supporting the given MediaType.
The template has to contain a single %s placeholder which will be replaced by the relation type.pathTemplate - must not be null or empty and contain a single placeholder.mediaTypes - the MediaTypes to support.public Optional<Link> findLinkWithRel(LinkRelation relation, String representation)
LinkDiscovererLinkRelation in the given String representation.findLinkWithRel in interface LinkDiscovererrelation - must not be null.representation - must not be null.Optional.empty() if none was found.public Optional<Link> findLinkWithRel(LinkRelation relation, InputStream representation)
LinkDiscovererLinkRelation in the given InputStream representation.findLinkWithRel in interface LinkDiscovererrelation - must not be null.representation - must not be null.Link with the given LinkRelation found, or Optional.empty() if none was
found.public Links findLinksWithRel(LinkRelation relation, String representation)
LinkDiscovererLinkRelation found in the given String representation.findLinksWithRel in interface LinkDiscovererrelation - must not be null.representation - must not be null.public Links findLinksWithRel(LinkRelation relation, InputStream representation)
LinkDiscovererLinkRelation found in the given InputStream representation.findLinksWithRel in interface LinkDiscovererrelation - must not be null.representation - must not be null.public boolean supports(@NonNull MediaType delimiter)
supports in interface org.springframework.plugin.core.Plugin<MediaType>protected Link extractLink(Object element, LinkRelation rel)
LinkDiscoverer to extract relevant attributes and generate a Link.element - rel - Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.