本文整理匯總了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;
}
示例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 );
}