com.github.fge.jsonschema.library
Class KeywordBuilder

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

public final class KeywordBuilder
extends Object
implements Thawed<Keyword>

A keyword builder -- the thawed version of a Keyword

Note that you may only supply a SyntaxChecker for a keyword, but if you supply a validator class, the digester must also be present.


Method Summary
 Keyword freeze()
          Build a frozen version of this builder
 KeywordBuilder withDigester(Digester digester)
          Add a digester to this builder
 KeywordBuilder withIdentityDigester(NodeType first, NodeType... other)
          Set this keyword's digester to be an IdentityDigester
 KeywordBuilder withSimpleDigester(NodeType first, NodeType... other)
          Set this keyword's digester to be a SimpleDigester
 KeywordBuilder withSyntaxChecker(com.github.fge.jsonschema.core.keyword.syntax.checkers.SyntaxChecker syntaxChecker)
          Add a syntax checker to this builder
 KeywordBuilder withValidatorClass(Class<? extends KeywordValidator> c)
          Set the validator class for this keyword
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

withSyntaxChecker

public KeywordBuilder withSyntaxChecker(com.github.fge.jsonschema.core.keyword.syntax.checkers.SyntaxChecker syntaxChecker)
Add a syntax checker to this builder

Parameters:
syntaxChecker - the syntax checker
Returns:
this
Throws:
NullPointerException - syntax checker is null

withDigester

public KeywordBuilder withDigester(Digester digester)
Add a digester to this builder

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

withIdentityDigester

public KeywordBuilder withIdentityDigester(NodeType first,
                                           NodeType... other)
Set this keyword's digester to be an IdentityDigester

Parameters:
first - the first instance type supported by this keyword
other - other instance types supported by this keyword
Returns:
this
Throws:
NullPointerException - one or more type(s) are null

withSimpleDigester

public KeywordBuilder withSimpleDigester(NodeType first,
                                         NodeType... other)
Set this keyword's digester to be a SimpleDigester

Parameters:
first - the first instance type supported by this keyword
other - other instance types supported by this keyword
Returns:
this
Throws:
NullPointerException - one or more type(s) are null

withValidatorClass

public KeywordBuilder withValidatorClass(Class<? extends KeywordValidator> c)
Set the validator class for this keyword

Parameters:
c - the class
Returns:
this
Throws:
NullPointerException - class is null
IllegalArgumentException - failed to find an appropriate constructor

freeze

public Keyword freeze()
Build a frozen version of this builder

Specified by:
freeze in interface Thawed<Keyword>
Returns:
a Keyword
Throws:
IllegalArgumentException - no syntax checker; or a constructor has been supplied without a digester
See Also:
Keyword.Keyword(KeywordBuilder)