public class StringValidator extends BasicValidator<String>
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
blacklistRegexes |
protected boolean |
matchFullInput |
protected Integer |
maxLength |
protected Integer |
minLength |
protected boolean |
notBlank |
protected boolean |
notEmpty |
protected String[] |
whitelistRegexes |
notNull, targetKey| Constructor and Description |
|---|
StringValidator(String targetKey) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isWhitelistedAndNotBlacklisted(String target) |
void |
setBlacklistRegexes(String[] blacklistRegexes) |
void |
setMatchFullInput(boolean matchFullInput) |
void |
setMaxLength(int maxLength) |
void |
setMinLength(int minLength) |
void |
setNotBlank(boolean notBlank) |
void |
setNotEmpty(boolean notEmpty) |
void |
setWhitelistRegexes(String[] whitelistRegexes) |
boolean |
validate(String target,
ValidationResult result) |
setNotNullprotected boolean notEmpty
protected boolean notBlank
protected Integer minLength
protected Integer maxLength
protected String[] whitelistRegexes
protected String[] blacklistRegexes
protected boolean matchFullInput
public StringValidator(String targetKey)
public void setNotEmpty(boolean notEmpty)
public void setNotBlank(boolean notBlank)
public void setMinLength(int minLength)
public void setMaxLength(int maxLength)
public void setWhitelistRegexes(String[] whitelistRegexes)
public void setBlacklistRegexes(String[] blacklistRegexes)
public void setMatchFullInput(boolean matchFullInput)
public boolean validate(String target, ValidationResult result)
protected boolean isWhitelistedAndNotBlacklisted(String target)
Copyright © 2018 CrafterCMS. All rights reserved.