Package com.networknt.schema
Class JsonMetaSchema.Builder
- java.lang.Object
-
- com.networknt.schema.JsonMetaSchema.Builder
-
- Enclosing class:
- JsonMetaSchema
public static class JsonMetaSchema.Builder extends java.lang.Object
Builder forJsonMetaSchema
.
-
-
Field Summary
Fields Modifier and Type Field Description private JsonMetaSchema.FormatKeywordFactory
formatKeywordFactory
private java.util.Map<java.lang.String,Format>
formats
private java.lang.String
idKeyword
private java.lang.String
iri
private java.util.Map<java.lang.String,Keyword>
keywords
private SpecVersion.VersionFlag
specification
private KeywordFactory
unknownKeywordFactory
private java.util.Map<java.lang.String,java.lang.Boolean>
vocabularies
private VocabularyFactory
vocabularyFactory
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String iri)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JsonMetaSchema.Builder
addFormat(Format format)
Deprecated.JsonMetaSchema.Builder
addFormats(java.util.Collection<? extends Format> formats)
Deprecated.JsonMetaSchema.Builder
addKeyword(Keyword keyword)
Deprecated.JsonMetaSchema.Builder
addKeywords(java.util.Collection<? extends Keyword> keywords)
Deprecated.JsonMetaSchema
build()
private java.util.Map<java.lang.String,Keyword>
createKeywordsMap(java.util.Map<java.lang.String,Keyword> kwords, java.util.Map<java.lang.String,Format> formats)
JsonMetaSchema.Builder
format(Format format)
Adds the format.JsonMetaSchema.Builder
formatKeywordFactory(JsonMetaSchema.FormatKeywordFactory formatKeywordFactory)
Sets the format keyword factory.JsonMetaSchema.Builder
formats(java.util.Collection<? extends Format> formats)
Adds the formats.JsonMetaSchema.Builder
formats(java.util.function.Consumer<java.util.Map<java.lang.String,Format>> customizer)
Customize the formats.JsonMetaSchema.Builder
idKeyword(java.lang.String idKeyword)
Sets the id keyword.JsonMetaSchema.Builder
keyword(Keyword keyword)
Adds the keyword.JsonMetaSchema.Builder
keywords(java.util.Collection<? extends Keyword> keywords)
Adds the keywords.JsonMetaSchema.Builder
keywords(java.util.function.Consumer<java.util.Map<java.lang.String,Keyword>> customizer)
Customize the keywords.JsonMetaSchema.Builder
specification(SpecVersion.VersionFlag specification)
Sets the specification.JsonMetaSchema.Builder
unknownKeywordFactory(KeywordFactory unknownKeywordFactory)
Sets the keyword factory for handling unknown keywords.JsonMetaSchema.Builder
vocabularies(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Boolean>> customizer)
Customize the vocabularies.JsonMetaSchema.Builder
vocabularies(java.util.Map<java.lang.String,java.lang.Boolean> vocabularies)
Adds the vocabularies.JsonMetaSchema.Builder
vocabulary(java.lang.String vocabulary)
Adds a required vocabulary.JsonMetaSchema.Builder
vocabulary(java.lang.String vocabulary, boolean required)
Adds a vocabulary.JsonMetaSchema.Builder
vocabularyFactory(VocabularyFactory vocabularyFactory)
Sets the vocabulary factory for handling custom vocabularies.
-
-
-
Field Detail
-
iri
private java.lang.String iri
-
idKeyword
private java.lang.String idKeyword
-
specification
private SpecVersion.VersionFlag specification
-
keywords
private final java.util.Map<java.lang.String,Keyword> keywords
-
formats
private final java.util.Map<java.lang.String,Format> formats
-
vocabularies
private final java.util.Map<java.lang.String,java.lang.Boolean> vocabularies
-
formatKeywordFactory
private JsonMetaSchema.FormatKeywordFactory formatKeywordFactory
-
vocabularyFactory
private VocabularyFactory vocabularyFactory
-
unknownKeywordFactory
private KeywordFactory unknownKeywordFactory
-
-
Method Detail
-
createKeywordsMap
private java.util.Map<java.lang.String,Keyword> createKeywordsMap(java.util.Map<java.lang.String,Keyword> kwords, java.util.Map<java.lang.String,Format> formats)
-
formatKeywordFactory
public JsonMetaSchema.Builder formatKeywordFactory(JsonMetaSchema.FormatKeywordFactory formatKeywordFactory)
Sets the format keyword factory.- Parameters:
formatKeywordFactory
- the format keyword factory- Returns:
- the builder
-
vocabularyFactory
public JsonMetaSchema.Builder vocabularyFactory(VocabularyFactory vocabularyFactory)
Sets the vocabulary factory for handling custom vocabularies.- Parameters:
vocabularyFactory
- the factory- Returns:
- the builder
-
unknownKeywordFactory
public JsonMetaSchema.Builder unknownKeywordFactory(KeywordFactory unknownKeywordFactory)
Sets the keyword factory for handling unknown keywords.- Parameters:
unknownKeywordFactory
- the factory- Returns:
- the builder
-
formats
public JsonMetaSchema.Builder formats(java.util.function.Consumer<java.util.Map<java.lang.String,Format>> customizer)
Customize the formats.- Parameters:
customizer
- the customizer- Returns:
- the builder
-
keywords
public JsonMetaSchema.Builder keywords(java.util.function.Consumer<java.util.Map<java.lang.String,Keyword>> customizer)
Customize the keywords.- Parameters:
customizer
- the customizer- Returns:
- the builder
-
keyword
public JsonMetaSchema.Builder keyword(Keyword keyword)
Adds the keyword.- Parameters:
keyword
- the keyword- Returns:
- the builder
-
keywords
public JsonMetaSchema.Builder keywords(java.util.Collection<? extends Keyword> keywords)
Adds the keywords.- Parameters:
keywords
- the keywords- Returns:
- the builder
-
format
public JsonMetaSchema.Builder format(Format format)
Adds the format.- Parameters:
format
- the format- Returns:
- the builder
-
formats
public JsonMetaSchema.Builder formats(java.util.Collection<? extends Format> formats)
Adds the formats.- Parameters:
formats
- the formats- Returns:
- the builder
-
vocabulary
public JsonMetaSchema.Builder vocabulary(java.lang.String vocabulary)
Adds a required vocabulary.Note that an error will be raised if this vocabulary is unknown.
- Parameters:
vocabulary
- the vocabulary IRI- Returns:
- the builder
-
vocabulary
public JsonMetaSchema.Builder vocabulary(java.lang.String vocabulary, boolean required)
Adds a vocabulary.- Parameters:
vocabulary
- the vocabulary IRIrequired
- true indicates if the vocabulary is not recognized processing should stop- Returns:
- the builder
-
vocabularies
public JsonMetaSchema.Builder vocabularies(java.util.Map<java.lang.String,java.lang.Boolean> vocabularies)
Adds the vocabularies.- Parameters:
vocabularies
- the vocabularies to add- Returns:
- the builder
-
vocabularies
public JsonMetaSchema.Builder vocabularies(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Boolean>> customizer)
Customize the vocabularies.- Parameters:
customizer
- the customizer- Returns:
- the builder
-
specification
public JsonMetaSchema.Builder specification(SpecVersion.VersionFlag specification)
Sets the specification.- Parameters:
specification
- the specification- Returns:
- the builder
-
idKeyword
public JsonMetaSchema.Builder idKeyword(java.lang.String idKeyword)
Sets the id keyword.- Parameters:
idKeyword
- the id keyword- Returns:
- the builder
-
build
public JsonMetaSchema build()
-
addKeyword
@Deprecated public JsonMetaSchema.Builder addKeyword(Keyword keyword)
Deprecated.
-
addKeywords
@Deprecated public JsonMetaSchema.Builder addKeywords(java.util.Collection<? extends Keyword> keywords)
Deprecated.
-
addFormat
@Deprecated public JsonMetaSchema.Builder addFormat(Format format)
Deprecated.
-
addFormats
@Deprecated public JsonMetaSchema.Builder addFormats(java.util.Collection<? extends Format> formats)
Deprecated.
-
-