io.vertx.ext.json.schema.common

## Class BaseSchemaParser

- java.lang.Object
- - io.vertx.ext.json.schema.common.BaseSchemaParser

- All Implemented Interfaces:
    SchemaParserInternal, SchemaParser
  Direct Known Subclasses:
    Draft201909SchemaParser, Draft7SchemaParser, OpenAPI3SchemaParser

      public abstract class BaseSchemaParser
      extends Object
      implements SchemaParserInternal

  Author:
    Francesco Guardiani @slinkydeveloper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SchemaRouter` | `router`
    `protected List<ValidatorFactory>` | `validatorFactories`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BaseSchemaParser(SchemaRouter router)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected SchemaImpl` | `createSchema(JsonObject schema, JsonPointer scope, MutableStateValidator parent)`
    `SchemaRouter` | `getSchemaRouter()` Get schema router registered to this schema parser
    `protected abstract List<ValidatorFactory>` | `initValidatorFactories()`
    `SchemaInternal` | `parse(Object jsonSchema, JsonPointer scope, MutableStateValidator parent)`
    `SchemaInternal` | `parseFromString(String unparsedJson, JsonPointer scope, MutableStateValidator parent)`
    `protected Map.Entry<Optional<JsonPointer>,Optional<String>>` | `resolveIdAndAlias(JsonObject schema, URI scope)`
    `BaseSchemaParser` | `withStringFormatValidator(String formatName, java.util.function.Predicate<String> predicate)` Add a custom format validator
    `BaseSchemaParser` | `withValidatorFactory(ValidatorFactory factory)` Add a `ValidatorFactory` to this schema parser to support custom keywords

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.ext.json.schema.common.SchemaParserInternal

      `parse, parse, parse, parse, parse, parse, parse, parseFromString, parseFromString, parseFromString, parseFromString`

    - ### Methods inherited from interface io.vertx.ext.json.schema.SchemaParser

      `createDraft201909SchemaParser, createDraft7SchemaParser, createOpenAPI3SchemaParser`

- - ### Field Detail

    - #### validatorFactories

          protected final List<ValidatorFactory> validatorFactories

    - #### router

          protected final SchemaRouter router

  - ### Constructor Detail

    - #### BaseSchemaParser

          protected BaseSchemaParser(SchemaRouter router)

  - ### Method Detail

    - #### getSchemaRouter

          public SchemaRouter getSchemaRouter()

      Description copied from interface: `SchemaParser`
      Get schema router registered to this schema parser
      Specified by:
        `getSchemaRouter` in interface `SchemaParser`
      Returns:

    - #### parse

          public SchemaInternal parse(Object jsonSchema,
                                      JsonPointer scope,
                                      MutableStateValidator parent)

      Specified by:
        `parse` in interface `SchemaParserInternal`

    - #### createSchema

          protected SchemaImpl createSchema(JsonObject schema,
                                            JsonPointer scope,
                                            MutableStateValidator parent)

    - #### initValidatorFactories

          protected abstract List<ValidatorFactory> initValidatorFactories()

    - #### resolveIdAndAlias

          protected Map.Entry<Optional<JsonPointer>,Optional<String>> resolveIdAndAlias(JsonObject schema,
                                                                                        URI scope)

    - #### withValidatorFactory

          public BaseSchemaParser withValidatorFactory(ValidatorFactory factory)

      Description copied from interface: `SchemaParser`
      Add a `ValidatorFactory` to this schema parser to support custom keywords
      Specified by:
        `withValidatorFactory` in interface `SchemaParser`
      Parameters:
        `factory` - new factory
      Returns:
        a reference to this

    - #### withStringFormatValidator

          public BaseSchemaParser withStringFormatValidator(String formatName,
                                                            java.util.function.Predicate<String> predicate)

      Description copied from interface: `SchemaParser`
      Add a custom format validator
      Specified by:
        `withStringFormatValidator` in interface `SchemaParser`
      Parameters:
        `formatName` - format name
        `predicate` - predicate for the new format
      Returns:
        a reference to this

    - #### parseFromString

          public SchemaInternal parseFromString(String unparsedJson,
                                                JsonPointer scope,
                                                MutableStateValidator parent)

      Specified by:
        `parseFromString` in interface `SchemaParserInternal`

Copyright © 2020 Eclipse. All rights reserved.