001: /*
002: * Copyright 2005-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005: * in compliance with the License. You may obtain a copy of the License at
006: *
007: * http://www.apache.org/licenses/LICENSE-2.0
008: *
009: * Unless required by applicable law or agreed to in writing, software distributed under the License
010: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011: * or implied. See the License for the specific language governing permissions and limitations under
012: * the License.
013: */
014:
015: package org.strecks.validator.impl;
016:
017: import org.strecks.validator.annotation.ValidateBlankOrNull;
018: import org.strecks.validator.annotation.ValidateBoolean;
019: import org.strecks.validator.annotation.ValidateByte;
020: import org.strecks.validator.annotation.ValidateCreditCard;
021: import org.strecks.validator.annotation.ValidateDate;
022: import org.strecks.validator.annotation.ValidateDouble;
023: import org.strecks.validator.annotation.ValidateEmail;
024: import org.strecks.validator.annotation.ValidateFloat;
025: import org.strecks.validator.annotation.ValidateInteger;
026: import org.strecks.validator.annotation.ValidateIntegerRange;
027: import org.strecks.validator.annotation.ValidateLong;
028: import org.strecks.validator.annotation.ValidateLongRange;
029: import org.strecks.validator.annotation.ValidateMaxLength;
030: import org.strecks.validator.annotation.ValidatePattern;
031: import org.strecks.validator.annotation.ValidateRequired;
032: import org.strecks.validator.annotation.ValidateShort;
033: import org.strecks.validator.annotation.ValidateUrl;
034:
035: /**
036: * @author Phil Zoio
037: */
038: public class ValidatableBean {
039:
040: String required;
041:
042: String blankOrNull;
043:
044: String maxLength;
045:
046: String doubleValue;
047:
048: String byteValue;
049:
050: String shortValue;
051:
052: String floatValue;
053:
054: String booleanValue;
055:
056: String longValue;
057:
058: String integerValue;
059:
060: String integerRangeValue;
061:
062: String longRangeValue;
063:
064: String dateValue;
065:
066: String strictDateValue;
067:
068: String urlValue;
069:
070: String emailValue;
071:
072: String creditCardValue;
073:
074: String patternValue;
075:
076: @ValidateBlankOrNull(key="must.be.blank.or.null")
077: public void setBlankOrNull(String blankOrNull) {
078: this .blankOrNull = blankOrNull;
079: }
080:
081: @ValidateDate(key="not.date")
082: public void setDateValue(String dateValue) {
083: this .dateValue = dateValue;
084: }
085:
086: @ValidateDouble(key="not.double")
087: public void setDoubleValue(String doubleValue) {
088: this .doubleValue = doubleValue;
089: }
090:
091: @ValidateInteger(key="not.integer")
092: public void setIntegerValue(String integerValue) {
093: this .integerValue = integerValue;
094: }
095:
096: @ValidateLong(key="not.long")
097: public void setLongValue(String longValue) {
098: this .longValue = longValue;
099: }
100:
101: @ValidateBoolean(key="not.boolean")
102: public void setBooleanValue(String booleanValue) {
103: this .booleanValue = booleanValue;
104: }
105:
106: @ValidateFloat(key="not.float")
107: public void setFloatValue(String floatValue) {
108: this .floatValue = floatValue;
109: }
110:
111: @ValidateShort(key="not.short")
112: public void setShortValue(String shortValue) {
113: this .shortValue = shortValue;
114: }
115:
116: @ValidateByte(key="not.byte")
117: public void setByteValue(String byteValue) {
118: this .byteValue = byteValue;
119: }
120:
121: @ValidateMaxLength(key="max.length.exceeded",maxLength=1)
122: public void setMaxLength(String maxLength) {
123: this .maxLength = maxLength;
124: }
125:
126: @ValidateRequired(key="is.required")
127: public void setRequired(String required) {
128: this .required = required;
129: }
130:
131: @ValidateDate(key="not.strict.date")
132: public void setStrictDateValue(String strictDateValue) {
133: this .strictDateValue = strictDateValue;
134: }
135:
136: @ValidateIntegerRange(key="not.in.range",min=0,max=1)
137: public void setIntegerRangeValue(String integerRangeValue) {
138: this .integerRangeValue = integerRangeValue;
139: }
140:
141: @ValidateLongRange(key="not.in.range",min=Long.MIN_VALUE)
142: public void setLongRangeValue(String longRangeValue) {
143: this .longRangeValue = longRangeValue;
144: }
145:
146: @ValidatePattern(key="not.pattern",pattern="a*b")
147: public void setPatternValue(String patternValue) {
148: this .patternValue = patternValue;
149: }
150:
151: @ValidateUrl(key="not.url")
152: public void setUrlValue(String urlValue) {
153: this .urlValue = urlValue;
154: }
155:
156: @ValidateEmail(key="not.email")
157: public void setEmailValue(String emailValue) {
158: this .emailValue = emailValue;
159: }
160:
161: @ValidateCreditCard(key="not.credit.card")
162: public void setCreditCardValue(String creditCardValue) {
163: this .creditCardValue = creditCardValue;
164: }
165:
166: public String getBlankOrNull() {
167: return blankOrNull;
168: }
169:
170: public String getDateValue() {
171: return dateValue;
172: }
173:
174: public String getDoubleValue() {
175: return doubleValue;
176: }
177:
178: public String getIntegerValue() {
179: return integerValue;
180: }
181:
182: public String getLongValue() {
183: return longValue;
184: }
185:
186: public String getMaxLength() {
187: return maxLength;
188: }
189:
190: public String getRequired() {
191: return required;
192: }
193:
194: public String getStrictDateValue() {
195: return strictDateValue;
196: }
197:
198: public String getIntegerRangeValue() {
199: return integerRangeValue;
200: }
201:
202: public String getLongRangeValue() {
203: return longRangeValue;
204: }
205:
206: public String getBooleanValue() {
207: return booleanValue;
208: }
209:
210: public String getByteValue() {
211: return byteValue;
212: }
213:
214: public String getFloatValue() {
215: return floatValue;
216: }
217:
218: public String getShortValue() {
219: return shortValue;
220: }
221:
222: public String getCreditCardValue() {
223: return creditCardValue;
224: }
225:
226: public String getEmailValue() {
227: return emailValue;
228: }
229:
230: public String getUrlValue() {
231: return urlValue;
232: }
233:
234: public String getPatternValue() {
235: return patternValue;
236: }
237:
238: }
|