Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NumericPatternConstraint |
|
| 2.0;2 |
1 | /* | |
2 | * Copyright 2005-2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php | |
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 | package org.kuali.rice.krad.datadictionary.validation.constraint; | |
17 | ||
18 | import org.apache.commons.lang.StringUtils; | |
19 | import org.kuali.rice.krad.uif.UifConstants; | |
20 | ||
21 | import javax.xml.bind.annotation.XmlAccessType; | |
22 | import javax.xml.bind.annotation.XmlAccessorType; | |
23 | ||
24 | ||
25 | /** | |
26 | * Pattern for matching numeric characters | |
27 | * | |
28 | * | |
29 | */ | |
30 | @XmlAccessorType(XmlAccessType.FIELD) | |
31 | 2 | public class NumericPatternConstraint extends ValidCharactersPatternConstraint { |
32 | /** | |
33 | * @see org.kuali.rice.krad.datadictionary.validation.ValidationPattern#getRegexString() | |
34 | */ | |
35 | protected String getRegexString() { | |
36 | 2 | return "[0-9]"; |
37 | } | |
38 | ||
39 | /** | |
40 | * This overridden method ... | |
41 | * | |
42 | * @see org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint#getLabelKey() | |
43 | */ | |
44 | @Override | |
45 | public String getLabelKey() { | |
46 | 2 | String labelKey = super.getLabelKey(); |
47 | 2 | if (StringUtils.isNotEmpty(labelKey)) { |
48 | 0 | return labelKey; |
49 | } | |
50 | 2 | return UifConstants.Messages.VALIDATION_MSG_KEY_PREFIX + "numericPattern"; |
51 | } | |
52 | ||
53 | } |