当前位置: 首页>>代码示例>>Java>>正文


Java EmailValidator.getInstance方法代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:MailActionExecuter.java

示例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);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:28,代码来源:UrkundReviewServiceImpl.java

示例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;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:TurnitinReviewServiceImpl.java

示例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;
}
 
开发者ID:Azanx,项目名称:Smart-Shopping,代码行数:8,代码来源:EmailVerificationValidator.java

示例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");
    }
    
}
 
开发者ID:university-information-system,项目名称:uis,代码行数:15,代码来源:UisUserValidator.java

示例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);
}
 
开发者ID:cilogi,项目名称:lid,代码行数:8,代码来源:SendLoginEmail.java

示例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.");
            }
        }
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:12,代码来源:CubeDesc.java

示例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;
}
 
开发者ID:leyestd,项目名称:leyeoa,代码行数:8,代码来源:RegexUtil.java

示例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 );
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:11,代码来源:AbstractExchangeAutodiscoverService.java

示例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);
}
 
开发者ID:saltykovdg,项目名称:java-spring-jspx-hibernate-template,代码行数:6,代码来源:UserDto.java

示例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!");
	}
}
 
开发者ID:simeon-nikolov,项目名称:SpeedTyper,代码行数:7,代码来源:UserController.java

示例12: matches

import org.apache.commons.validator.routines.EmailValidator; //导入方法依赖的package包/类
@Override
public boolean matches(String value) {
    EmailValidator validator = EmailValidator.getInstance();
    return validator.isValid(value);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:6,代码来源:HIPAAMatcherAttributeValue.java

示例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 );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:15,代码来源:StringUtil.java


注:本文中的org.apache.commons.validator.routines.EmailValidator.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。