本文整理匯總了Java中org.oscm.validator.ADMValidator.isEmail方法的典型用法代碼示例。如果您正苦於以下問題:Java ADMValidator.isEmail方法的具體用法?Java ADMValidator.isEmail怎麽用?Java ADMValidator.isEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.oscm.validator.ADMValidator
的用法示例。
在下文中一共展示了ADMValidator.isEmail方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validate
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
/**
* Validates that the given value contains an email address.
*
* @param context
* FacesContext for the request we are processing
* @param component
* UIComponent we are checking for correctness
* @param value
* the value to validate
* @throws ValidatorException
* if validation fails
*/
public void validate(FacesContext facesContext, UIComponent component,
Object value) throws ValidatorException {
if (value == null) {
return;
}
String email = value.toString();
if (email.length() == 0) {
return;
}
if (!ADMValidator.isEmail(email)) {
Object[] args = null;
String label = JSFUtils.getLabel(component);
if (label != null) {
args = new Object[] { label };
}
ValidationException e = new ValidationException(
ValidationException.ReasonEnum.EMAIL, label, null);
String text = JSFUtils.getText(e.getMessageKey(), args,
facesContext);
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, text, null));
}
}
示例2: validateMail
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
private static void validateMail(PlatformConfigurationKey key, String value) {
if (!ADMValidator.isEmail(value)) {
throw new RuntimeException("The email format of " + key
+ " must be valid.");
}
}
示例3: validateMail
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
private static void validateMail(ConfigurationKey key, String value) {
if (!ADMValidator.isEmail(value)) {
throw new RuntimeException("The email format of "
+ key.getKeyName() + " must be valid.");
}
}