Class HalConfiguration
java.lang.Object
org.springframework.hateoas.mediatype.hal.HalConfiguration
HAL specific configuration.
- Author:
- Greg Turnquist, Oliver Drotbohm
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Configuration option how to render single links of a givenLinkRelation
. -
Constructor Summary
ConstructorDescriptionCreates a new defaultHalConfiguration
rendering single links as immediate sub-document. -
Method Summary
Modifier and TypeMethodDescriptioncustomize
(com.fasterxml.jackson.databind.ObjectMapper mapper) boolean
boolean
withApplyPropertyNamingStrategy
(boolean applyPropertyNamingStrategy) Create a newHalConfiguration
by copying the attributes and replacing the applyProperNamingStrategy.withEnforceEmbeddedCollections
(boolean enforceEmbeddedCollections) Create a newHalConfiguration
by copying the attributes and replacing the enforceEmbeddedCollections.withMediaType
(MediaType mediaType) Registers additional media types that are supposed to be aliases toMediaTypes.HAL_JSON
.withObjectMapperCustomizer
(Consumer<com.fasterxml.jackson.databind.ObjectMapper> objectMapperCustomizer) Configures anObjectMapper
customizer to tweak the instance after it has been pre-configured with all HAL specific setup.withRenderSingleLinks
(HalConfiguration.RenderSingleLinks renderSingleLinks) Create a newHalConfiguration
by copying the attributes and replacing the renderSingleLinks.withRenderSingleLinksFor
(String pattern, HalConfiguration.RenderSingleLinks renderSingleLinks) Configures how to render a single link for the given link relation pattern, i.e. this can be either a fixed link relation (likesearch
), take wildcards to e.g. match links of a given curie (likeacme:*
) or even complete URIs (likehttps://api.acme.com/foo/**
).withRenderSingleLinksFor
(LinkRelation relation, HalConfiguration.RenderSingleLinks renderSingleLinks) Configures how to render a single link for a given particularLinkRelation
.
-
Constructor Details
-
HalConfiguration
public HalConfiguration()Creates a new defaultHalConfiguration
rendering single links as immediate sub-document.
-
-
Method Details
-
withRenderSingleLinksFor
public HalConfiguration withRenderSingleLinksFor(LinkRelation relation, HalConfiguration.RenderSingleLinks renderSingleLinks) Configures how to render a single link for a given particularLinkRelation
. This will override what has been configured viawithRenderSingleLinks(RenderSingleLinks)
for that particular link relation.- Parameters:
relation
- must not be null.renderSingleLinks
- must not be null.- Returns:
-
withRenderSingleLinksFor
public HalConfiguration withRenderSingleLinksFor(String pattern, HalConfiguration.RenderSingleLinks renderSingleLinks) Configures how to render a single link for the given link relation pattern, i.e. this can be either a fixed link relation (likesearch
), take wildcards to e.g. match links of a given curie (likeacme:*
) or even complete URIs (likehttps://api.acme.com/foo/**
).- Parameters:
pattern
- must not be null or empty.renderSingleLinks
- must not be null.- Returns:
- See Also:
-
withRenderSingleLinks
Create a newHalConfiguration
by copying the attributes and replacing the renderSingleLinks.- Parameters:
renderSingleLinks
- must not be null.- Returns:
- will never be null.
-
withApplyPropertyNamingStrategy
Create a newHalConfiguration
by copying the attributes and replacing the applyProperNamingStrategy.- Parameters:
applyPropertyNamingStrategy
-- Returns:
-
withEnforceEmbeddedCollections
Create a newHalConfiguration
by copying the attributes and replacing the enforceEmbeddedCollections.- Parameters:
enforceEmbeddedCollections
-- Returns:
-
withObjectMapperCustomizer
public HalConfiguration withObjectMapperCustomizer(Consumer<com.fasterxml.jackson.databind.ObjectMapper> objectMapperCustomizer) Configures anObjectMapper
customizer to tweak the instance after it has been pre-configured with all HAL specific setup.- Parameters:
objectMapperCustomizer
- must not be null.- Returns:
- will never be null.
-
withMediaType
Registers additional media types that are supposed to be aliases toMediaTypes.HAL_JSON
. RegisteredMediaType
s will be preferred over the default one, i.e. they'll be listed first in client's accept headers etc.- Parameters:
mediaType
- must not be null.- Returns:
- will never be null.
- Since:
- 1.3
-
getRenderSingleLinks
-
isApplyPropertyNamingStrategy
public boolean isApplyPropertyNamingStrategy() -
isEnforceEmbeddedCollections
public boolean isEnforceEmbeddedCollections() -
customize
-