當前位置: 首頁>>代碼示例>>Java>>正文


Java EmailValidator.isValid方法代碼示例

本文整理匯總了Java中org.apache.commons.validator.routines.EmailValidator.isValid方法的典型用法代碼示例。如果您正苦於以下問題:Java EmailValidator.isValid方法的具體用法?Java EmailValidator.isValid怎麽用?Java EmailValidator.isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.validator.routines.EmailValidator的用法示例。


在下文中一共展示了EmailValidator.isValid方法的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.isValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。