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.cfg;
 
 
 import java.util.Map;

Validation configuration (frozen instance)

This allows you to configure the following aspects of validation:

  • add your own schema keywords via libraries, with an associated $schema value;
  • whether to use format;
  • what default keyword library should be used.

The default configuration has both draft v4 and draft v3 libraries preloaded, and format validation is enabled; the default library to use is draft v4.

 
 public final class ValidationConfiguration
 {
    
Map of keyword libraries and their associated URIs

The URIs here are what is expected in $schema.

 
     final Map<JsonRefLibrarylibraries;

    
Default keyword library to use

This is the library used when no $schema could be found in a submitted/downloaded schema.

 
     final Library defaultLibrary;

    
Whether to use format in the resulting factory
 
     final boolean useFormat;

    
The set of syntax messages
 
     final MessageBundle syntaxMessages;

    
The set of validation messages
 
     final MessageBundle validationMessages;

    
Return a new thawed instance of the default configuration

Returns:
a new configuration builder
See also:
ValidationConfigurationBuilder.ValidationConfigurationBuilder.()
 
     public static ValidationConfigurationBuilder newBuilder()
     {
         return new ValidationConfigurationBuilder();
     }

    
Return a default, frozen configuration

Returns:
a new configuration
 
    public static ValidationConfiguration byDefault()
    {
        return newBuilder().freeze();
    }

    
Build a new frozen configuration out of a thawed one

Parameters:
builder the source configuration
See also:
ValidationConfigurationBuilder.freeze()
    {
         = ImmutableMap.copyOf(builder.libraries);
         = builder.defaultLibrary;
         = builder.useFormat;
         = builder.syntaxMessages;
         = builder.validationMessages;
    }

    
Return the map of libraries for this configuration

Returns:
an immutable map
    public Map<JsonRefLibrarygetLibraries()
    {
        return ;
    }

    
Return the default library to use

Returns:
a library
    public Library getDefaultLibrary()
    {
        return ;
    }

    
Whether format should be used

Returns:
true if the answer is yes
    public boolean getUseFormat()
    {
        return ;
    }
    {
        return ;
    }
    {
        return ;
    }

    
Return a thawed instance out of this frozen configuration

    @Override
    {
        return new ValidationConfigurationBuilder(this);
    }
New to GrepCode? Check out our FAQ X