Class HalFormsConfiguration

java.lang.Object
org.springframework.hateoas.mediatype.hal.forms.HalFormsConfiguration

public class HalFormsConfiguration extends Object
HAL-FORMS specific configuration extension of HalConfiguration.
Author:
Greg Turnquist, Oliver Drotbohm
  • Constructor Details

  • Method Details

    • withPattern

      public HalFormsConfiguration withPattern(Class<?> type, String pattern)
      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.
    • withMapperBuilderCustomizer

      public HalFormsConfiguration withMapperBuilderCustomizer(UnaryOperator<tools.jackson.databind.json.JsonMapper.Builder> customizer)
      Register the given UnaryOperator to apply additional customizations on the JsonMapper.Builder used to render HAL documents.
      Parameters:
      customizer - must not be null.
      Returns:
      will never be null.
    • withMediaType

      public HalFormsConfiguration withMediaType(org.springframework.http.MediaType mediaType)
      Registers additional media types that are supposed to be aliases to MediaTypes.HAL_FORMS_JSON. Registered MediaTypes 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

      public tools.jackson.databind.json.JsonMapper.Builder customize(tools.jackson.databind.json.JsonMapper.Builder builder)
      Customizes the given JsonMapper with the registered callback.
      Parameters:
      mapper - must not be null.
      Returns:
      will never be null.
      See Also:
    • withOptions

      public <T> HalFormsConfiguration withOptions(Class<T> type, String property, Function<AffordanceModel.PropertyMetadata,HalFormsOptions> creator)
      Returns a new HalFormsConfiguration with the given
      Type Parameters:
      T -
      Parameters:
      type - the
      property -
      creator -
      Returns:
    • withDefaultSingleTemplate

      public HalFormsConfiguration withDefaultSingleTemplate(boolean defaultSingleTemplate)
      Configures whether to use the name default in case only a single template appears. Defaults to false. Set this to true in case you need the legacy behavior.
      Parameters:
      defaultSingleTemplate -
      Returns:
      will never be null.
      Since:
      3.0
    • getHalConfiguration

      public HalConfiguration getHalConfiguration()
      Returns the underlying HalConfiguration.
      Returns:
      will never be null.