Class SchemaLoader


  • public class SchemaLoader
    extends Object
    Loads a JSON schema's JSON representation into schema validator instances.
    • Constructor Detail

      • SchemaLoader

        public SchemaLoader​(SchemaLoader.SchemaLoaderBuilder builder)
        Constructor.
        Parameters:
        builder - the builder containing the properties. Only SchemaLoader.SchemaLoaderBuilder.id is nullable.
        Throws:
        NullPointerException - if any of the builder properties except id is null.
    • Method Detail

      • load

        public static Schema load​(org.json.JSONObject schemaJson)
        Loads a JSON schema to a schema validator using a default 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 a Schema.Builder instance from the schemaJson schema definition.
        Returns:
        the builder which already contains the validation criteria of the schema, therefore Schema.Builder.build() can be immediately used to acquire the Schema instance to be used for validation