public final class KeywordBundle extends Object
You can either create a new, completely empty, keyword bundle, or use one of the default bundles and extend it. For instance:
// Returns an empty bundle
final KeywordBundle bundle = new KeywordBundle();
final Keyword k1 = ...;
final Keyword k2 = ...;
bundle.registerKeyword(k1);
bundle.registerKeyword(k2);
Keyword,
KeywordBundles,
JsonSchemaFactory| Constructor and Description |
|---|
KeywordBundle() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,SyntaxChecker> |
getSyntaxCheckers()
Get the list of syntax checkers for this bundle
|
Map<String,Class<? extends KeywordValidator>> |
getValidators()
Get the list of keyword validators for this bundle
|
void |
mergeWith(KeywordBundle other)
Merge with another keyword bundle
|
void |
registerKeyword(Keyword keyword)
Register a keyword for this bundle
|
void |
unregisterKeyword(String name)
Unregister a keyword
|
public void registerKeyword(Keyword keyword)
Note that if a keyword by the same name already exists, its syntax
validator and keyword validator will be reset to the new values (and
unregistered if any of these is null).
keyword - the keyword to registerKeyword.Builder,
Keywordpublic void unregisterKeyword(String name)
name - the name of the keyword to unregisterpublic void mergeWith(KeywordBundle other)
Note: this operation is potentially dangerous if you are not careful. This method blindingly replaces the existing bundle's syntax checkers and keyword validators with those of the other bundle. Use with care!
other - the other bundlepublic Map<String,SyntaxChecker> getSyntaxCheckers()
public Map<String,Class<? extends KeywordValidator>> getValidators()
Copyright © 2012. All Rights Reserved.