Package org.everit.json.schema.loader
Class SchemaLoader
- java.lang.Object
-
- org.everit.json.schema.loader.SchemaLoader
-
public class SchemaLoader extends java.lang.ObjectLoads a JSON schema's JSON representation into schema validator instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchemaLoader.SchemaLoaderBuilderBuilder class forSchemaLoader.
-
Constructor Summary
Constructors Constructor Description SchemaLoader(SchemaLoader.SchemaLoaderBuilder builder)Constructor.
-
Method Summary
Modifier and Type Method Description static SchemaLoader.SchemaLoaderBuilderbuilder()Schema.Builder<?>load()Populates aSchema.Builderinstance from theschemaJsonschema definition.static Schemaload(org.json.JSONObject schemaJson)Loads a JSON schema to a schema validator using adefault HTTP client.static Schemaload(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.idis nullable.- Throws:
java.lang.NullPointerException- if any of the builder properties exceptidisnull.
-
-
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.Builderinstance from theschemaJsonschema definition.- Returns:
- the builder which already contains the validation criteria of the schema, therefore
Schema.Builder.build()can be immediately used to acquire theSchemainstance to be used for validation
-
-