Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2013, Francis Galiegue <>
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the Lesser GNU General Public License as
  * published by the Free Software Foundation, either version 3 of the
  * License, or (at your option) any later version.
  * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * Lesser GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <>.
package com.github.fge.jsonschema.format.common;
Validator for the email format attribute.

Important note: the basis for email format validation is RFC 5322. The RFC mandates that email addresses have a domain part. However, that domain part may consist of a single domain name component. As such, foo@bar is considered valid.

public final class EmailAttribute
    extends AbstractFormatAttribute
    private static final FormatAttribute INSTANCE = new EmailAttribute();
    public static FormatAttribute getInstance()
        return ;
    private EmailAttribute()
    public void validate(final ProcessingReport reportfinal FullData data)
        throws ProcessingException
        final JsonNode instance = data.getInstance().getNode();
        try {
            new InternetAddress(instance.textValue(), true);
        } catch (AddressException ignored) {
New to GrepCode? Check out our FAQ X