io.vertx.json.schema.common

## Class SchemaRouterImpl

- java.lang.Object
- - io.vertx.json.schema.common.SchemaRouterImpl

- All Implemented Interfaces:
    SchemaRouter

      public class SchemaRouterImpl
      extends Object
      implements SchemaRouter

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SchemaRouterImpl(HttpClient client, FileSystem fs, SchemaRouterOptions options)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SchemaRouter` | `addJson(URI uri, JsonObject object)` Add one or more json documents including schemas on top or inner levels.
    `SchemaRouter` | `addSchema(Schema schema, JsonPointer... aliasScope)` Add a parsed schema to this router.
    `SchemaRouter` | `addSchemaAlias(Schema schema, String alias)` Add an alias to a schema already registered in this router (this alias can be solved only from schema scope).
    `SchemaRouter` | `addSchemaWithScope(Schema schema, JsonPointer scope)` Add a parsed schema to this router.
    `void` | `insertRouterNode(JsonPointer pointer, io.vertx.json.schema.common.RouterNode nodeToWrite)`
    `void` | `insertSchema(JsonPointer pointer, io.vertx.json.schema.common.RouterNode initialNode, Schema schema)`
    `List<Schema>` | `registeredSchemas()`
    `Future<Void>` | `resolveAllSchemas()`
    `Schema` | `resolveCachedSchema(JsonPointer refPointer, JsonPointer scope, SchemaParser parser)` Resolve cached schema based on refPointer.
    `Future<Schema>` | `resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser)` Resolve $ref.
    `void` | `resolveRef(JsonPointer pointer, JsonPointer scope, SchemaParser schemaParser, Handler<AsyncResult<Schema>> handler)` Like `SchemaRouter.resolveRef(JsonPointer, JsonPointer, SchemaParser)` but with a direct callback.
    `Future<Schema>` | `solveAllSchemaReferences(Schema schema)` Deeply resolve all references of the provided `schema`

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

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

    - ### Methods inherited from interface io.vertx.json.schema.SchemaRouter

      `addJson, create, create`

- - ### Constructor Detail

    - #### SchemaRouterImpl

          public SchemaRouterImpl(HttpClient client,
                                  FileSystem fs,
                                  SchemaRouterOptions options)

  - ### Method Detail

    - #### registeredSchemas

          public List<Schema> registeredSchemas()

      Specified by:
        `registeredSchemas` in interface `SchemaRouter`
      Returns:
        a list of all registered schemas

    - #### resolveCachedSchema

          public Schema resolveCachedSchema(JsonPointer refPointer,
                                            JsonPointer scope,
                                            SchemaParser parser)

      Description copied from interface: `SchemaRouter`
      Resolve cached schema based on refPointer. If a schema isn't cached, it returns null
      Specified by:
        `resolveCachedSchema` in interface `SchemaRouter`
      Returns:
        the resolved schema, or null if no schema was found

    - #### resolveRef

          public void resolveRef(JsonPointer pointer,
                                 JsonPointer scope,
                                 SchemaParser schemaParser,
                                 Handler<AsyncResult<Schema>> handler)

      Description copied from interface: `SchemaRouter`
      Like `SchemaRouter.resolveRef(JsonPointer, JsonPointer, SchemaParser)` but with a direct callback.
      Specified by:
        `resolveRef` in interface `SchemaRouter`

    - #### resolveRef

          public Future<Schema> resolveRef(JsonPointer pointer,
                                           JsonPointer scope,
                                           SchemaParser schemaParser)

      Description copied from interface: `SchemaRouter`
      Resolve $ref.
      This method tries to resolve schema from local cache. If it's not found, it solve external references. It can solve external references on filesystem and remote references using http. When you pass a relative reference without protocol, it tries to infer the absolute path from scope and cached schemas
      Returns a future that can contain Schema or be null or can fail with a `SchemaException` or an `IllegalArgumentException`
      Specified by:
        `resolveRef` in interface `SchemaRouter`
      Returns:
        a succeeded future that contains the resolved `Schema` or failed with a `SchemaException` or an `IllegalArgumentException`

    - #### addSchema

          public SchemaRouter addSchema(Schema schema,
                                        JsonPointer... aliasScope)

      Description copied from interface: `SchemaRouter`
      Add a parsed schema to this router. When a schema is added to the cache, a new entry is created for `Schema.getScope()` and, if you provide additional aliasScopes, this method register links to this schema with these scopes. This method is automatically called by `SchemaParser` when a new schema is parsed
      Specified by:
        `addSchema` in interface `SchemaRouter`
      Parameters:
        `schema` - schema to add
      Returns:
        a reference to this

    - #### addSchemaWithScope

          public SchemaRouter addSchemaWithScope(Schema schema,
                                                 JsonPointer scope)

      Description copied from interface: `SchemaRouter`
      Add a parsed schema to this router. When a schema is added to the cache, a new entry is created for the provided scope, but NOT for `Schema.getScope()`. This may be useful to register links to singleton schemas. This method is automatically called by `SchemaParser` when a new schema is parsed
      Specified by:
        `addSchemaWithScope` in interface `SchemaRouter`
      Parameters:
        `schema` - schema to add
      Returns:
        a reference to this

    - #### addSchemaAlias

          public SchemaRouter addSchemaAlias(Schema schema,
                                             String alias)

      Description copied from interface: `SchemaRouter`
      Add an alias to a schema already registered in this router (this alias can be solved only from schema scope).
      Specified by:
        `addSchemaAlias` in interface `SchemaRouter`
      Parameters:
        `schema` - schema to add
        `alias` - the schema alias
      Returns:
        a reference to this

    - #### addJson

          public SchemaRouter addJson(URI uri,
                                      JsonObject object)

      Description copied from interface: `SchemaRouter`
      Add one or more json documents including schemas on top or inner levels. This method doesn't trigger the schema parsing

      You can use this schema if you have externally loaded some json document and you want to register to the schema router. You can later parse and retrieve a schema from this json structure using `this#resolveCachedSchema(JsonPointer, JsonPointer, SchemaParser)`, providing the correct `refPointer`

      Specified by:
        `addJson` in interface `SchemaRouter`
      Returns:
        a reference to this

    - #### resolveAllSchemas

          public Future<Void> resolveAllSchemas()

    - #### solveAllSchemaReferences

          public Future<Schema> solveAllSchemaReferences(Schema schema)

      Deeply resolve all references of the provided `schema`
      Parameters:
        `schema` -
      Returns:
        returns a succeeded future with same instance of provided schema, or a failed schema if something went wrong

    - #### insertSchema

          public void insertSchema(JsonPointer pointer,
                                   io.vertx.json.schema.common.RouterNode initialNode,
                                   Schema schema)

    - #### insertRouterNode

          public void insertRouterNode(JsonPointer pointer,
                                       io.vertx.json.schema.common.RouterNode nodeToWrite)

Copyright © 2021 Eclipse. All rights reserved.