本文整理汇总了Java中org.apache.commons.validator.routines.EmailValidator.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java EmailValidator.getInstance方法的具体用法?Java EmailValidator.getInstance怎么用?Java EmailValidator.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.validator.routines.EmailValidator
的用法示例。
在下文中一共展示了EmailValidator.getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateAddress
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
/**
* Return true if address has valid format
* @param address String
* @return boolean
*/
private boolean validateAddress(String address)
{
boolean result = false;
// Validate the email, allowing for local email addresses
EmailValidator emailValidator = EmailValidator.getInstance(true);
if (!validateAddresses || emailValidator.isValid(address))
{
result = true;
}
else
{
logger.error("Failed to send email to '" + address + "' as the address is incorrectly formatted" );
}
return result;
}
示例2: isValidEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
/**
* Is this a valid email the service will recognize
*
* @param email
* @return
*/
private boolean isValidEmail(String email) {
if (email == null || email.equals("")) {
return false;
}
email = email.trim();
//must contain @
if (!email.contains("@")) {
return false;
}
//an email can't contain spaces
if (email.indexOf(" ") > 0) {
return false;
}
//use commons-validator
EmailValidator validator = EmailValidator.getInstance();
return validator.isValid(email);
}
示例3: isValidEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
/**
* Is this a valid email the service will recognize
*
* @param email
* @return
*/
private boolean isValidEmail(String email) {
// TODO: Use a generic Sakai utility class (when a suitable one exists)
if (email == null || email.equals(""))
return false;
email = email.trim();
// must contain @
if (email.indexOf("@") == -1)
return false;
// an email can't contain spaces
if (email.indexOf(" ") > 0)
return false;
// use commons-validator
EmailValidator validator = EmailValidator.getInstance();
if (validator.isValid(email))
return true;
return false;
}
示例4: isValid
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
@Override
public boolean isValid(String email, ConstraintValidatorContext context) {
EmailValidator emailValidator = EmailValidator.getInstance();
if((email == null) || (!emailValidator.isValid(email)))
return false;
return true;
}
示例5: validateEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
/**
* Validates the email address.
* Local domains are not allowed. Not all errors are caught.
*/
public void validateEmail(String email) {
EmailValidator validator = EmailValidator.getInstance();
boolean isValid = validator.isValid(email);
if (!isValid) {
throw new ValidationException("This is not a valid email");
}
}
示例6: isLegalEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
public boolean isLegalEmail(String emailAddress) {
if ("".equals(emailAddress.trim())) {
return false;
}
EmailValidator validator = EmailValidator.getInstance();
return validator.isValid(emailAddress);
}
示例7: validateNotifyList
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
public void validateNotifyList() {
List<String> notifyList = getNotifyList();
if (notifyList != null && !notifyList.isEmpty()) {
EmailValidator emailValidator = EmailValidator.getInstance();
for (String email: notifyList) {
if (!emailValidator.isValid(email)) {
throw new IllegalArgumentException("Email [" + email + "] is not validation.");
}
}
}
}
示例8: isEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
public static boolean isEmail(String email) {
EmailValidator validator = EmailValidator.getInstance();
if (!validator.isValid(email)) {
return false;
}
return true;
}
示例9: extractDomainFromEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
protected String extractDomainFromEmail(String email) throws AutodiscoverException{
EmailValidator validator = EmailValidator.getInstance(false);
if(StringUtils.isNotBlank(email) && validator.isValid(email)){
String domain = StringUtils.substringAfter(email, "@");
if(StringUtils.isNotBlank(domain)){
return domain;
}
}
throw new AutodiscoverException("INVALID EMAIL: "+email );
}
示例10: isCorrectEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
@AssertTrue(groups = ValidationLevels.ValidationFirst.class)
public boolean isCorrectEmail() {
EmailValidator emailValidator = EmailValidator.getInstance();
return emailValidator.isValid(email);
}
示例11: validateEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
private void validateEmail(String email) {
EmailValidator validator = EmailValidator.getInstance();
if (!validator.isValid(email)) {
throw new IllegalArgumentException("Email addres is not valid!");
}
}
示例12: matches
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
@Override
public boolean matches(String value) {
EmailValidator validator = EmailValidator.getInstance();
return validator.isValid(value);
}
示例13: isValidEmail
import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
/**
* ***********************************************************************************
* Removes Special HTML Tags and Non-AlfaNumeric Chars
*
* @param email Email to be validated
*
* @return Is valid mail
*/
public static boolean isValidEmail( String email )
{
EmailValidator emailvalidator = EmailValidator.getInstance();
return emailvalidator.isValid( email );
}