Top Description Inners Methods
javax.validation

public Interface MessageInterpolator

Imports
java.util.Locale, javax.validation.metadata.ConstraintDescriptor

Interpolates a given constraint violation message.

Implementations should be as tolerant as possible on syntax errors. Implementations must be thread-safe.

Authors
Emmanuel Bernard, Hardy Ferentschik

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
MessageInterpolator.Context

Information related to the interpolation context.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

interpolated error message
interpolate
(String
the message to interpolate
messageTemplate
,
MessageInterpolator.Context
contextual information related to the interpolation
context
)

Interpolates the message template based on the constraint validation context.

public String

Returns:

interpolated error message
interpolate
(String
the message to interpolate
messageTemplate
,
MessageInterpolator.Context
contextual information related to the interpolation
context
,
Locale
the locale targeted for the message
locale
)

Interpolates the message template based on the constraint validation context.

Method Detail

interpolateback to summary
public String interpolate(String messageTemplate, MessageInterpolator.Context context)

Interpolates the message template based on the constraint validation context.

The locale is defaulted according to the MessageInterpolator implementation. See the implementation documentation for more detail.

Parameters
messageTemplate:String

the message to interpolate

context:MessageInterpolator.Context

contextual information related to the interpolation

Returns:String

interpolated error message

interpolateback to summary
public String interpolate(String messageTemplate, MessageInterpolator.Context context, Locale locale)

Interpolates the message template based on the constraint validation context. The Locale used is provided as a parameter.

Parameters
messageTemplate:String

the message to interpolate

context:MessageInterpolator.Context

contextual information related to the interpolation

locale:Locale

the locale targeted for the message

Returns:String

interpolated error message

javax.validation back to summary

public Interface MessageInterpolator.Context


Information related to the interpolation context.

Method Summary

Modifier and TypeMethod and Description
public ConstraintDescriptor<?>

Returns:

ConstraintDescriptor corresponding to the constraint being validated
getConstraintDescriptor
()

public Object

Returns:

value being validated
getValidatedValue
()

public <
the type of the object to be returned
T
>
T

Returns:

an instance of the specified class
unwrap
(Class<T>
the class of the object to be returned
type
)

Returns an instance of the specified type allowing access to provider-specific APIs.

Method Detail

getConstraintDescriptorback to summary
public ConstraintDescriptor<?> getConstraintDescriptor()
Returns:ConstraintDescriptor<?>

ConstraintDescriptor corresponding to the constraint being validated

getValidatedValueback to summary
public Object getValidatedValue()
Returns:Object

value being validated

unwrapback to summary
public <T> T unwrap(Class<T> type)

Returns an instance of the specified type allowing access to provider-specific APIs. If the Bean Validation provider implementation does not support the specified class, ValidationException is thrown.

Parameters
<T>
the type of the object to be returned
type:Class<T>

the class of the object to be returned

Returns:T

an instance of the specified class

Exceptions
ValidationException:
if the provider does not support the call
Since
1.1