Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2013, Francis Galiegue <fgaliegue@gmail.com>
  *
  * 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
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * 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 <http://www.gnu.org/licenses/>.
 */
package com.github.fge.jsonschema.format;
Base abstract class for a format attribute

You should really use this class instead of implementing FormatAttribute directly. Its main, but important, helping role is to build the list of supported types for you.

public abstract class AbstractFormatAttribute
    implements FormatAttribute
    private static final MessageBundle BUNDLE = .;

    
The set of supported types
    private final EnumSet<NodeTypesupported;

    
The name of the format attribute
    private final String fmt;

    
Protected constructor

Parameters:
fmt the name for this format attribute
first first supported type
other other supported types, if any
See also:
supportedTypes()
    protected AbstractFormatAttribute(final String fmtfinal NodeType first,
        final NodeType... other)
    {
        this. = fmt;
         = EnumSet.of(firstother);
    }
    @Override
    public final EnumSet<NodeTypesupportedTypes()
    {
        return EnumSet.copyOf();
    }

    
Return a new message for this format attribute

Parameters:
data the validation context
key key in the format bundle message
Returns:
a new message
    protected final ProcessingMessage newMsg(final FullData data,
        final String key)
    {
        return data.newMessage().put("domain""validation")
            .put("keyword""format").put("attribute")
            .message(.getString(key))
            .put("value"data.getInstance().getNode());
    }
New to GrepCode? Check out our FAQ X