Class HalFormsConfiguration
java.lang.Object
org.springframework.hateoas.mediatype.hal.forms.HalFormsConfiguration
HAL-FORMS specific configuration extension of
HalConfiguration.- Author:
- Greg Turnquist, Oliver Drotbohm
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newHalFormsConfigurationbacked by a defaultHalConfiguration.HalFormsConfiguration(HalConfiguration halConfiguration) Creates a newHalFormsConfigurationfor the givenHalConfiguration. -
Method Summary
Modifier and TypeMethodDescriptioncustomize(com.fasterxml.jackson.databind.ObjectMapper mapper) Customizes the givenObjectMapperwith the registered callback.Returns the underlyingHalConfiguration.withMediaType(MediaType mediaType) Registers additional media types that are supposed to be aliases toMediaTypes.HAL_FORMS_JSON.withObjectMapperCustomizer(Consumer<com.fasterxml.jackson.databind.ObjectMapper> objectMapperCustomizer) Register the givenConsumerto apply additional customizations on theObjectMapperused to render HAL documents.withOptions(Class<T> type, String property, Function<AffordanceModel.PropertyMetadata, HalFormsOptions> creator) Returns a newHalFormsConfigurationwith the givenwithPattern(Class<?> type, String pattern) Registers a regular expression pattern to be used for form descriptions of the given type.
-
Constructor Details
-
HalFormsConfiguration
public HalFormsConfiguration()Creates a newHalFormsConfigurationbacked by a defaultHalConfiguration. -
HalFormsConfiguration
Creates a newHalFormsConfigurationfor the givenHalConfiguration.- Parameters:
halConfiguration- must not be null.
-
-
Method Details
-
withPattern
Registers a regular expression pattern to be used for form descriptions of the given type.- Parameters:
type- must not be null.pattern- must not be null or empty.- Returns:
- will never be null.
-
withObjectMapperCustomizer
public HalFormsConfiguration withObjectMapperCustomizer(Consumer<com.fasterxml.jackson.databind.ObjectMapper> objectMapperCustomizer) Register the givenConsumerto apply additional customizations on theObjectMapperused to render HAL documents.- Parameters:
objectMapperCustomizer- must not be null.- Returns:
- will never be null.
-
withMediaType
Registers additional media types that are supposed to be aliases toMediaTypes.HAL_FORMS_JSON. RegisteredMediaTypes 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.4
-
customize
Customizes the givenObjectMapperwith the registered callback.- Parameters:
mapper- must not be null.- Returns:
- See Also:
-
withOptions
public <T> HalFormsConfiguration withOptions(Class<T> type, String property, Function<AffordanceModel.PropertyMetadata, HalFormsOptions> creator) Returns a newHalFormsConfigurationwith the given- Type Parameters:
T-- Parameters:
type- theproperty-creator-- Returns:
-
getHalConfiguration
Returns the underlyingHalConfiguration.- Returns:
- will never be null.
-