Package org.everit.json.schema.loader
Class SchemaLoader
- java.lang.Object
-
- org.everit.json.schema.loader.SchemaLoader
-
public class SchemaLoader extends Object
Loads a JSON schema's JSON representation into schema validator instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SchemaLoader.SchemaLoaderBuilder
Builder class forSchemaLoader
.
-
Constructor Summary
Constructors Constructor Description SchemaLoader(SchemaLoader.SchemaLoaderBuilder builder)
Constructor.
-
Method Summary
Modifier and Type Method Description static SchemaLoader.SchemaLoaderBuilder
builder()
Schema.Builder<?>
load()
Populates aSchema.Builder
instance from theschemaJson
schema definition.static Schema
load(org.json.JSONObject schemaJson)
Loads a JSON schema to a schema validator using adefault HTTP client
.static Schema
load(org.json.JSONObject schemaJson, SchemaClient schemaClient)
Creates Schema instance from its JSON representation.
-
-
-
Constructor Detail
-
SchemaLoader
public SchemaLoader(SchemaLoader.SchemaLoaderBuilder builder)
Constructor.- Parameters:
builder
- the builder containing the properties. OnlySchemaLoader.SchemaLoaderBuilder.id
is nullable.- Throws:
NullPointerException
- if any of the builder properties exceptid
isnull
.
-
-
Method Detail
-
builder
public static SchemaLoader.SchemaLoaderBuilder builder()
-
load
public static Schema load(org.json.JSONObject schemaJson)
Loads a JSON schema to a schema validator using adefault HTTP client
.- Parameters:
schemaJson
- the JSON representation of the schema.- Returns:
- the schema validator object
-
load
public static Schema load(org.json.JSONObject schemaJson, SchemaClient schemaClient)
Creates Schema instance from its JSON representation.- Parameters:
schemaJson
- the JSON representation of the schema.schemaClient
- the HTTP client to be used for resolving remote JSON references.- Returns:
- the created schema
-
load
public Schema.Builder<?> load()
Populates aSchema.Builder
instance from theschemaJson
schema definition.- Returns:
- the builder which already contains the validation criteria of the schema, therefore
Schema.Builder.build()
can be immediately used to acquire theSchema
instance to be used for validation
-
-