Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2014, Francis Galiegue (fgaliegue@gmail.com)
  *
  * This software is dual-licensed under:
  *
  * - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
  *   later version;
  * - the Apache Software License (ASL) version 2.0.
  *
 * The text of this file and of both licenses is available at the root of this
 * project or, if you have the jar distribution, in directory META-INF/, under
 * the names LGPL-3.0.txt and ASL-2.0.txt respectively.
 *
 * Direct link to the sources:
 *
 * - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
 * - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
 */
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
{
    
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 MessageBundle bundlefinal String key)
    {
        return data.newMessage().put("domain""validation")
            .put("keyword""format").put("attribute")
            .setMessage(bundle.getMessage(key))
            .put("value"data.getInstance().getNode());
    }
New to GrepCode? Check out our FAQ X