KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > validation > MessageCodesResolver


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.validation;
18
19 /**
20  * Strategy interface for building message codes from validation error codes.
21  * Used by DataBinder to build the codes list for ObjectErrors and FieldErrors.
22  *
23  * <p>The resulting message codes correspond to the codes of a
24  * MessageSourceResolvable (as implemented by ObjectError and FieldError).
25  *
26  * @author Juergen Hoeller
27  * @since 1.0.1
28  * @see DataBinder#setMessageCodesResolver
29  * @see ObjectError
30  * @see FieldError
31  * @see org.springframework.context.MessageSourceResolvable#getCodes()
32  */

33 public interface MessageCodesResolver {
34
35     /**
36      * Build message codes for the given error code and object name.
37      * Used for building the codes list of an ObjectError.
38      * @param errorCode the error code used for rejecting the object
39      * @param objectName the name of the object
40      * @return the message codes to use
41      */

42     String JavaDoc[] resolveMessageCodes(String JavaDoc errorCode, String JavaDoc objectName);
43
44     /**
45      * Build message codes for the given error code and field specification.
46      * Used for building the codes list of an FieldError.
47      * @param errorCode the error code used for rejecting the value
48      * @param objectName the name of the object
49      * @param field the field name
50      * @param fieldType the field type (may be <code>null</code> if not determinable)
51      * @return the message codes to use
52      */

53     String JavaDoc[] resolveMessageCodes(String JavaDoc errorCode, String JavaDoc objectName, String JavaDoc field, Class JavaDoc fieldType);
54
55 }
56
Popular Tags