|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ValidationStrings.java | - | 100% | 50% | 66.7% |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.valid; | |
16 | ||
17 | import java.util.Locale; | |
18 | import java.util.ResourceBundle; | |
19 | ||
20 | /** | |
21 | * Constants used for accessing validation message patterns. | |
22 | * | |
23 | * @author Paul Ferraro | |
24 | */ | |
25 | public final class ValidationStrings | |
26 | { | |
27 | public static final String REQUIRED_TEXT_FIELD = "field-is-required"; | |
28 | public static final String REQUIRED_SELECT_FIELD = "select-field-is-required"; | |
29 | public static final String REQUIRED_FILE_FIELD = "file-field-is-required"; | |
30 | ||
31 | public static final String INVALID_DATE = "invalid-date-format"; | |
32 | public static final String INVALID_NUMBER = "invalid-numeric-format"; | |
33 | public static final String INVALID_EMAIL = "invalid-email-format"; | |
34 | ||
35 | public static final String REGEX_MISMATCH = "regex-mismatch"; | |
36 | ||
37 | public static final String VALUE_TOO_SHORT = "field-too-short"; | |
38 | public static final String VALUE_TOO_LONG = "field-too-long"; | |
39 | ||
40 | public static final String VALUE_TOO_SMALL = "number-too-small"; | |
41 | public static final String VALUE_TOO_LARGE = "number-too-large"; | |
42 | ||
43 | public static final String DATE_TOO_EARLY = "date-too-small"; | |
44 | public static final String DATE_TOO_LATE = "date-too-large"; | |
45 | ||
46 | public static final String INVALID_FIELD_EQUALITY = "invalid-field-equality"; | |
47 | ||
48 | private static final String RESOURCE_BUNDLE = ValidationStrings.class.getName(); | |
49 | ||
50 | /** | |
51 | * Fetches the appropriate validation message pattern from the appropriate localized resource. | |
52 | * This method should be called with the locale of the current request. | |
53 | */ | |
54 | 20 | public static String getMessagePattern(String key, Locale locale) |
55 | { | |
56 | 20 | return ResourceBundle.getBundle(RESOURCE_BUNDLE, locale).getString(key); |
57 | } | |
58 | ||
59 | 0 | private ValidationStrings() |
60 | { | |
61 | // Disable construction | |
62 | } | |
63 | } |
|