|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.valjax.AbstractValidator
net.sf.valjax.AbstractBlackListValidator
public abstract class AbstractBlackListValidator
Provides validation for a configured black list file.
Implements afterPropertiesSet
using the black list file from setBlacklistFile
and loads the contents into a HashSet
that
is used to validate values against. Each line in the blacklist is its own
entry in the HashSet
.
Concrete implementations of this class need to follow the contract
stated in the Validator
interface.
Concrete classes can also provide there own blacklist files, which will
override the default blacklist file.
This is a one blackListFile
per Validator
setup. You can
use the default blacklist file or you can supply your own, but you can not
use both.
Validator
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Fields inherited from class net.sf.valjax.AbstractValidator |
---|
NAME_PATTERN_1, NAME_PATTERN_2, PATTERN_ADDRESS, PATTERN_ALPHA, PATTERN_ALPHANUMERIC, PATTERN_CURRENCY, PATTERN_DATE, PATTERN_DIGITS, PATTERN_FAX, PATTERN_MONTH, PATTERN_MONTH_YEAR, PATTERN_NUMBER, PATTERN_PHONE, PATTERN_YEAR, PATTERN_ZIP |
Constructor Summary | |
---|---|
AbstractBlackListValidator()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Loads the blackListFile in a HashSet
that will be used to validate against. |
Boolean |
isBlackListEmail(String value)
Validates whether an email is on the blacklist or not. |
Boolean |
isBlackListValue(String value)
Validates whether an value is on the blacklist or not. |
void |
setBlackListFile(String blackListFile)
The name of the blacklist file to load from the classpath. |
Methods inherited from class net.sf.valjax.AbstractValidator |
---|
isAddress, isAlpha, isAlphaNumeric, isCurrency, isDate, isDigits, isFamilyName, isFax, isGivenName, isMonth, isMonthYear, isNumber, isPhone, isYear, isZip, validateCustom |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.validation.Validator |
---|
supports, validate |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public AbstractBlackListValidator()
Method Detail |
---|
public Boolean isBlackListEmail(String value)
Strips the email address using the '@' symbol and check each piece to see if it is on the blacklist.
value
- The String
to check.
public Boolean isBlackListValue(String value)
value
- The input to validate.
value
is on the blacklist or not.public void afterPropertiesSet()
HashSet
that will be used to validate against.
BlackListFile is taken from the claspath fed into an
InputStreamReader
as an InputStream
.
Concrete implementation of this class can supply their own blackList
file or can use the default, but you can not use both.
afterPropertiesSet
in interface InitializingBean
public void setBlackListFile(String blackListFile)
blackListFile
- The blacklist file to load.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |