public class DefaultCurieProvider extends Object implements CurieProvider
CurieProvider
rendering a single configurable UriTemplate
based curie.Modifier and Type | Class and Description |
---|---|
protected static class |
DefaultCurieProvider.Curie
Value object to get the curie
Link rendered in JSON. |
Constructor and Description |
---|
DefaultCurieProvider(Map<String,UriTemplate> curies)
Creates a new
DefaultCurieProvider for the given curies. |
DefaultCurieProvider(Map<String,UriTemplate> curies,
String defaultCurieName)
Creates a new
DefaultCurieProvider for the given curies using the one with the given name as default, which
means to expand unprefixed, non-IANA link relations. |
DefaultCurieProvider(String name,
UriTemplate uriTemplate)
Creates a new
DefaultCurieProvider for the given name and UriTemplate . |
Modifier and Type | Method and Description |
---|---|
protected String |
getCurieHref(String name,
UriTemplate template)
Returns the href for the
DefaultCurieProvider.Curie instance to be created. |
Collection<? extends Object> |
getCurieInformation(Links links)
Returns an object to render as the base curie information.
|
String |
getNamespacedRelFor(String rel)
Returns the rel to be rendered for the given rel.
|
String |
getNamespacedRelFrom(Link link)
Returns the rel to be rendered for the given
Link . |
public DefaultCurieProvider(String name, UriTemplate uriTemplate)
DefaultCurieProvider
for the given name and UriTemplate
. The curie will be used to
expand previously unprefixed, non-IANA link relations.name
- must not be null or empty.uriTemplate
- must not be null and contain exactly one template variable.public DefaultCurieProvider(Map<String,UriTemplate> curies)
DefaultCurieProvider
for the given curies. If more than one curie is given, no default curie
will be registered. Use DefaultCurieProvider(Map, String)
to define which of the provided curies shall be
used as the default one.curies
- must not be null.DefaultCurieProvider(String, UriTemplate)
public DefaultCurieProvider(Map<String,UriTemplate> curies, String defaultCurieName)
DefaultCurieProvider
for the given curies using the one with the given name as default, which
means to expand unprefixed, non-IANA link relations.curies
- must not be null.defaultCurieName
- can be null.public Collection<? extends Object> getCurieInformation(Links links)
CurieProvider
getCurieInformation
in interface CurieProvider
links
- the Links
that have been added to the response so far.public String getNamespacedRelFrom(Link link)
CurieProvider
Link
. Will potentially prefix the rel but also might decide
not to, depending on the actual rel.getNamespacedRelFrom
in interface CurieProvider
public String getNamespacedRelFor(String rel)
CurieProvider
getNamespacedRelFor
in interface CurieProvider
protected String getCurieHref(String name, UriTemplate template)
DefaultCurieProvider.Curie
instance to be created. Will prepend the current application URI (servlet
mapping) in case the template is not an absolute one in the first place.name
- will never be null or empty.template
- will never be null.String
to be used as href in the DefaultCurieProvider.Curie
to be created, must not be null.Copyright © 2012-2016–2018 Pivotal, Inc.. All rights reserved.