View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.custom.validatebeanbehavior;
20  
21  import javax.faces.component.UIComponent;
22  
23  /**
24   * This class contains all validation related properties for a single UIInput component.
25   *
26   * @author Jan-Kees van Andel
27   */
28  final class ValidationPropertyModel {
29  
30      /**
31       * Is this field required?
32       */
33      private boolean required;
34  
35      /**
36       * The type of the field, for syntactic validation.
37       */
38      private String type;
39  
40      /**
41       * The minimum and maximum value of a number.
42       */
43      private Long min, max;
44  
45      /**
46       * A validator that checks if a date is in the future. Today is not considered a future date.
47       */
48      private boolean futureDate;
49  
50      /**
51       * The format (SimpleDateFormat pattern) of a date field.
52       */
53      private String dateFormat;
54  
55      /**
56       * The corresponding component.
57       */
58      private UIComponent component;
59  
60      public boolean isRequired() {
61          return required;
62      }
63  
64      public void setRequired(boolean required) {
65          this.required = required;
66      }
67  
68      public String getType() {
69          return type;
70      }
71  
72      public void setType(String type) {
73          this.type = type;
74      }
75  
76      public Long getMin() {
77          return min;
78      }
79  
80      public void setMin(Long min) {
81          this.min = min;
82      }
83  
84      public Long getMax() {
85          return max;
86      }
87  
88      public void setMax(Long max) {
89          this.max = max;
90      }
91  
92      public boolean isFutureDate() {
93          return futureDate;
94      }
95  
96      public void setFutureDate(boolean futureDate) {
97          this.futureDate = futureDate;
98      }
99  
100     public String getDateFormat() {
101         return dateFormat;
102     }
103 
104     public void setDateFormat(String dateFormat) {
105         this.dateFormat = dateFormat;
106     }
107 
108     public UIComponent getComponent() {
109         return component;
110     }
111 
112     public void setComponent(UIComponent component) {
113         this.component = component;
114     }
115 }