public class EmailValidator extends BaseJsonValidator
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.
.applyDefaultsStrategy, failFast, parentSchema, schemaNode, schemaPath, validationContext
Constructor and Description |
---|
EmailValidator(String schemaPath,
com.fasterxml.jackson.databind.JsonNode schemaNode,
JsonSchema parentSchema,
ValidationContext validationContext,
String formatName,
ValidatorTypeCode type) |
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.
|
atPath, atPath, atRoot, buildValidationMessage, checkDiscriminatorMatch, constructValidationMessage, debug, equals, fetchSubSchemaNode, getNodeFieldType, getParentSchema, getPathType, getSchemaNode, getSchemaPath, getValidatorType, greaterThan, isPartOfOneOfMultipleType, lessThan, parseErrorCode, preloadJsonSchemas, registerAndMergeDiscriminator, validate, walk
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
preloadJsonSchema
public EmailValidator(String schemaPath, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema, ValidationContext validationContext, String formatName, ValidatorTypeCode type)
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
node
- JsonNoderootNode
- JsonNodeat
- StringCopyright © 2023. All rights reserved.