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.helpers;
Abstract class for date/time related format attributes

Joda Time is used for date and time parsing: it can handle all defined formats, and catches more errors than the standard JDK's java.text.SimpleDateFormat does.

Furthermore (and more importantly), unlike java.text.SimpleDateFormat, Joda Time's org.joda.time.format.DateTimeFormatter is thread-safe!

public abstract class DateFormatAttribute
    extends AbstractFormatAttribute
    private final String format;
    private final DateTimeFormatter formatter;
    protected DateFormatAttribute(final String fmtfinal String format)
        this. = format;
         = DateTimeFormat.forPattern(format);
    public final void validate(final ProcessingReport report,
        final FullData data)
        throws ProcessingException
        final JsonNode instance = data.getInstance().getNode();
        try {
        } catch (IllegalArgumentException ignored) {
New to GrepCode? Check out our FAQ X