/*
* Copyright 2005-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.strecks.validator.impl;
import org.strecks.validator.annotation.ValidateBlankOrNull;
import org.strecks.validator.annotation.ValidateBoolean;
import org.strecks.validator.annotation.ValidateByte;
import org.strecks.validator.annotation.ValidateCreditCard;
import org.strecks.validator.annotation.ValidateDate;
import org.strecks.validator.annotation.ValidateDouble;
import org.strecks.validator.annotation.ValidateEmail;
import org.strecks.validator.annotation.ValidateFloat;
import org.strecks.validator.annotation.ValidateInteger;
import org.strecks.validator.annotation.ValidateIntegerRange;
import org.strecks.validator.annotation.ValidateLong;
import org.strecks.validator.annotation.ValidateLongRange;
import org.strecks.validator.annotation.ValidateMaxLength;
import org.strecks.validator.annotation.ValidatePattern;
import org.strecks.validator.annotation.ValidateRequired;
import org.strecks.validator.annotation.ValidateShort;
import org.strecks.validator.annotation.ValidateUrl;
/**
* @author Phil Zoio
*/
public class ValidatableBean
{
String required;
String blankOrNull;
String maxLength;
String doubleValue;
String byteValue;
String shortValue;
String floatValue;
String booleanValue;
String longValue;
String integerValue;
String integerRangeValue;
String longRangeValue;
String dateValue;
String strictDateValue;
String urlValue;
String emailValue;
String creditCardValue;
String patternValue;
@ValidateBlankOrNull(key = "must.be.blank.or.null")
public void setBlankOrNull(String blankOrNull)
{
this.blankOrNull = blankOrNull;
}
@ValidateDate(key = "not.date")
public void setDateValue(String dateValue)
{
this.dateValue = dateValue;
}
@ValidateDouble(key = "not.double")
public void setDoubleValue(String doubleValue)
{
this.doubleValue = doubleValue;
}
@ValidateInteger(key = "not.integer")
public void setIntegerValue(String integerValue)
{
this.integerValue = integerValue;
}
@ValidateLong(key = "not.long")
public void setLongValue(String longValue)
{
this.longValue = longValue;
}
@ValidateBoolean(key = "not.boolean")
public void setBooleanValue(String booleanValue)
{
this.booleanValue = booleanValue;
}
@ValidateFloat(key = "not.float")
public void setFloatValue(String floatValue)
{
this.floatValue = floatValue;
}
@ValidateShort(key = "not.short")
public void setShortValue(String shortValue)
{
this.shortValue = shortValue;
}
@ValidateByte(key = "not.byte")
public void setByteValue(String byteValue)
{
this.byteValue = byteValue;
}
@ValidateMaxLength(key = "max.length.exceeded", maxLength = 1)
public void setMaxLength(String maxLength)
{
this.maxLength = maxLength;
}
@ValidateRequired(key = "is.required")
public void setRequired(String required)
{
this.required = required;
}
@ValidateDate(key = "not.strict.date")
public void setStrictDateValue(String strictDateValue)
{
this.strictDateValue = strictDateValue;
}
@ValidateIntegerRange(key = "not.in.range", min = 0, max = 1)
public void setIntegerRangeValue(String integerRangeValue)
{
this.integerRangeValue = integerRangeValue;
}
@ValidateLongRange(key = "not.in.range", min = Long.MIN_VALUE)
public void setLongRangeValue(String longRangeValue)
{
this.longRangeValue = longRangeValue;
}
@ValidatePattern(key = "not.pattern", pattern = "a*b")
public void setPatternValue(String patternValue)
{
this.patternValue = patternValue;
}
@ValidateUrl(key = "not.url")
public void setUrlValue(String urlValue)
{
this.urlValue = urlValue;
}
@ValidateEmail(key = "not.email")
public void setEmailValue(String emailValue)
{
this.emailValue = emailValue;
}
@ValidateCreditCard(key = "not.credit.card")
public void setCreditCardValue(String creditCardValue)
{
this.creditCardValue = creditCardValue;
}
public String getBlankOrNull()
{
return blankOrNull;
}
public String getDateValue()
{
return dateValue;
}
public String getDoubleValue()
{
return doubleValue;
}
public String getIntegerValue()
{
return integerValue;
}
public String getLongValue()
{
return longValue;
}
public String getMaxLength()
{
return maxLength;
}
public String getRequired()
{
return required;
}
public String getStrictDateValue()
{
return strictDateValue;
}
public String getIntegerRangeValue()
{
return integerRangeValue;
}
public String getLongRangeValue()
{
return longRangeValue;
}
public String getBooleanValue()
{
return booleanValue;
}
public String getByteValue()
{
return byteValue;
}
public String getFloatValue()
{
return floatValue;
}
public String getShortValue()
{
return shortValue;
}
public String getCreditCardValue()
{
return creditCardValue;
}
public String getEmailValue()
{
return emailValue;
}
public String getUrlValue()
{
return urlValue;
}
public String getPatternValue()
{
return patternValue;
}
}
|