public class EmailValidator extends BaseJsonValidator implements JsonValidator
Perform email validations.
Based on a script by Sandeep V. Tamhankar http://javascript.internet.com
This implementation is not guaranteed to catch all possible errors in an email address.
.config, failFast, validatorState
AT_ROOT
Constructor and Description |
---|
EmailValidator(String schemaPath,
com.fasterxml.jackson.databind.JsonNode schemaNode,
JsonSchema parentSchema,
ValidationContext validationContext,
String formatName) |
Modifier and Type | Method and Description |
---|---|
boolean |
isValid(String email)
Checks if a field has a valid e-mail address.
|
protected boolean |
isValidDomain(String domain)
Returns true if the domain component of an email address is valid.
|
protected boolean |
isValidUser(String user)
Returns true if the user component of an email address is valid.
|
Set<ValidationMessage> |
validate(com.fasterxml.jackson.databind.JsonNode node,
com.fasterxml.jackson.databind.JsonNode rootNode,
String at)
Validate the given JsonNode, the given node is the child node of the root node at given
data path.
|
buildValidationMessage, debug, equals, fetchSubSchemaNode, getNodeFieldType, getParentSchema, getSchemaNode, getSchemaPath, getValidatorType, greaterThan, lessThan, parseErrorCode, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validate
public EmailValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidationContext validationContext, String formatName)
public boolean isValid(String email)
Checks if a field has a valid e-mail address.
email
- The value validation is being performed on. A null
value is considered invalid.protected boolean isValidDomain(String domain)
domain
- being validated, may be in IDN formatprotected boolean isValidUser(String user)
user
- being validatedpublic Set<ValidationMessage> validate(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode rootNode, String at)
JsonValidator
validate
in interface JsonValidator
node
- JsonNoderootNode
- JsonNodeat
- StringCopyright © 2020. All rights reserved.