com.github.fge.jsonschema.library
Class LibraryBuilder

java.lang.Object
  extended by com.github.fge.jsonschema.library.LibraryBuilder
All Implemented Interfaces:
Thawed<Library>

public final class LibraryBuilder
extends Object
implements Thawed<Library>

Mutable version of a library

This is what you will use when you wish to create your own metaschema and add either new keywords or format attributes to it.

Important note: if you add a keyword which already existed in this builder, all traces of its previous definition, if any, will be removed.


Method Summary
 LibraryBuilder addFormatAttribute(String name, FormatAttribute attribute)
          Add a format attribute
 LibraryBuilder addKeyword(Keyword keyword)
          Add a new keyword to this library
 Library freeze()
          Return a frozen version of this builder
 LibraryBuilder removeFormatAttribute(String name)
          Remove a format attribute by its name
 LibraryBuilder removeKeyword(String name)
          Remove a keyword by its name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addKeyword

public LibraryBuilder addKeyword(Keyword keyword)
Add a new keyword to this library

Parameters:
keyword - the keyword
Returns:
this
Throws:
NullPointerException - keyword is null

removeKeyword

public LibraryBuilder removeKeyword(String name)
Remove a keyword by its name

Parameters:
name - the name
Returns:
this
Throws:
NullPointerException - name is null

addFormatAttribute

public LibraryBuilder addFormatAttribute(String name,
                                         FormatAttribute attribute)
Add a format attribute

Parameters:
name - the name for this attribute
attribute - the format attribute
Returns:
this
Throws:
NullPointerException - the name or attribute is null

removeFormatAttribute

public LibraryBuilder removeFormatAttribute(String name)
Remove a format attribute by its name

Parameters:
name - the format attribute name
Returns:
this
Throws:
NullPointerException - name is null

freeze

public Library freeze()
Return a frozen version of this builder

Specified by:
freeze in interface Thawed<Library>
Returns:
a new Library
See Also:
Library.Library(LibraryBuilder)