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 javax.xml.bind.annotation.XmlAccessType; | |
19 | import javax.xml.bind.annotation.XmlAccessorType; | |
20 | ||
21 | import org.apache.commons.lang.StringUtils; | |
22 | ||
23 | ||
24 | /** | |
25 | * Pattern for matching numeric characters | |
26 | * | |
27 | * | |
28 | */ | |
29 | @XmlAccessorType(XmlAccessType.FIELD) | |
30 | 0 | public class NumericPatternConstraint extends ValidCharactersPatternConstraint { |
31 | /** | |
32 | * @see org.kuali.rice.krad.datadictionary.validation.ValidationPattern#getRegexString() | |
33 | */ | |
34 | protected String getRegexString() { | |
35 | 0 | return "[0-9]"; |
36 | } | |
37 | ||
38 | /** | |
39 | * This overridden method ... | |
40 | * | |
41 | * @see org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint#getLabelKey() | |
42 | */ | |
43 | @Override | |
44 | public String getLabelKey() { | |
45 | 0 | String labelKey = super.getLabelKey(); |
46 | 0 | if (StringUtils.isNotEmpty(labelKey)) { |
47 | 0 | return labelKey; |
48 | } | |
49 | 0 | StringBuilder key = new StringBuilder(""); |
50 | 0 | key.append("numericPattern,"); |
51 | 0 | return key.toString(); |
52 | } | |
53 | ||
54 | } |