[hibernate-issues] [Hibernate-JIRA] Commented: (BVAL-136) Add Context object for MessageInterpolator

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Mar 12 17:21:38 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/BVAL-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32647#action_32647 ] 

Emmanuel Bernard commented on BVAL-136:
---------------------------------------

/**
 * Interpolate a given constraint error message.
 * Implementations should be as tolerant as possible on syntax errors.
 *
 * @author Emmanuel Bernard
 * @author Hardy Ferentschik
 */
public interface MessageInterpolator {
	/**
	 * Interpolate the message from the constraint parameters and the actual validated object.
	 * The locale is defaulted according to the <code>MessageInterpolator</code> implementation
	 * See the implementation documentation for more detail.
	 *
	 * @param messageTemplate The message to interpolate.
	 * @param context contextual information related to the interpolation
	 *
	 * @return Interpolated error message.
	 */
	String interpolate(String messageTemplate,
					   Context context);

	/**
	 * Interpolate the message from the constraint parameters and the actual validated object.
	 * The Locale used is provided as a parameter
	 *
	 * @param messageTemplate The message to interpolate.
	 * @param context contextual information related to the interpolation
	 * @param locale the locale targeted for the message
	 *
	 * @return Interpolated error message.
	 */
	String interpolate(String messageTemplate,
					   Context context,
					   Locale locale);

	/**
	 * Informations related to the interpolation context
	 */
	static interface Context {
		/**
		 * @return ConstraintDescriptor corresponding to the constraint being validated
		 */
		ConstraintDescriptor<?> getConstraintDescriptor();

		/**
		 * @return value being validated
		 */
		Object getValidatedValue();
	}
}

> Add Context object for MessageInterpolator
> ------------------------------------------
>
>                 Key: BVAL-136
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-136
>             Project: Bean Validation
>          Issue Type: Improvement
>          Components: spec-general
>    Affects Versions: 1.0 public draft
>            Reporter: Emmanuel Bernard
>             Fix For: 1.0 proposed final draft
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list