com.github.fge.jsonschema.examples
Class Example7

java.lang.Object
  extended by com.github.fge.jsonschema.examples.ExampleBase
      extended by com.github.fge.jsonschema.examples.Example7

public final class Example7
extends ExampleBase

Seventh example: custom URI scheme

link to source code

This demonstrates JsonSchemaFactory's ability to register a custom URI scheme. In this example, the scheme is foobar, and it is simply an alias to fetch a resource from the current package.

Two things are needed:

Once this is done, this scheme, when encountered anywhere in JSON References, will use this downloader, and you are also able to use it when loading schemas using JsonSchemaFactory.getJsonSchema(String), which is what this example does.

The schema and files used are the same as for Example2.


Constructor Summary
Example7()
           
 
Method Summary
static void main(String... args)
           
 
Methods inherited from class com.github.fge.jsonschema.examples.ExampleBase
loadResource, printReport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Example7

public Example7()
Method Detail

main

public static void main(String... args)
                 throws IOException,
                        ProcessingException
Throws:
IOException
ProcessingException


Copyright © 2014. All Rights Reserved.