Package org.springframework.validation.beanvalidation

# Class LocaleContextMessageInterpolator

java.lang.Object
org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator

All Implemented Interfaces:
  `MessageInterpolator`

public class LocaleContextMessageInterpolator extends Object implements MessageInterpolator
Delegates to a target `MessageInterpolator` implementation but enforces Spring's managed Locale. Typically used to wrap the validation provider's default interpolator.

Since:
  3.0
Author:
  Juergen Hoeller
See Also:
  - `LocaleContextHolder.getLocale()`

## Nested Class Summary

## Nested classes/interfaces inherited from interface jakarta.validation.MessageInterpolator

`MessageInterpolator.Context`

## Constructor Summary

Constructors
Constructor
Description
`LocaleContextMessageInterpolator(MessageInterpolator targetInterpolator)`
Create a new LocaleContextMessageInterpolator, wrapping the given target interpolator.

## Method Summary

Modifier and Type
Method
Description
`String`
`interpolate(String message, MessageInterpolator.Context context)`
`String`
`interpolate(String message, MessageInterpolator.Context context, Locale locale)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LocaleContextMessageInterpolator

public LocaleContextMessageInterpolator(MessageInterpolator targetInterpolator)
Create a new LocaleContextMessageInterpolator, wrapping the given target interpolator.

Parameters:
  `targetInterpolator` - the target MessageInterpolator to wrap

## Method Details

### interpolate

public String interpolate(String message, MessageInterpolator.Context context)

Specified by:
  `interpolate` in interface `MessageInterpolator`

### interpolate

public String interpolate(String message, MessageInterpolator.Context context, Locale locale)

Specified by:
  `interpolate` in interface `MessageInterpolator`