io.vertx.json.schema.common

## Class SchemaImpl

- java.lang.Object
- - io.vertx.json.schema.common.BaseMutableStateValidator
  - - io.vertx.json.schema.common.SchemaImpl

- All Implemented Interfaces:
    AsyncValidator, MutableStateValidator, PriorityGetter, SchemaInternal, SyncValidator, Validator, Schema
  Direct Known Subclasses:
    RecursiveRefSchema, RefSchema

      public class SchemaImpl
      extends BaseMutableStateValidator
      implements SchemaInternal

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `shouldRecordContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SchemaImpl(JsonObject schema, JsonPointer scope, MutableStateValidator parent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `calculateIsSync()`
    `protected ValidatorContext` | `generateValidationContext(ValidatorContext parent)`
    `JsonObject` | `getJson()`
    `Future<Object>` | `getOrApplyDefaultAsync(Object input)`
    `Object` | `getOrApplyDefaultSync(Object input)`
    `JsonPointer` | `getScope()`
    `protected Future<Void>` | `runAsyncValidators(ValidatorContext context, Object in)`
    `protected void` | `runSyncValidator(ValidatorContext context, Object in)`
    `void` | `triggerUpdateIsSync()` Manually trigger the sync state update
    `Future<Void>` | `validateAsync(Object json)` Validate the json performing an asynchronous validation.
    `Future<Void>` | `validateAsync(ValidatorContext context, Object in)` Return a Future that succeed when the validation succeed, while fail with a `ValidationException` when validation fails
    `void` | `validateSync(Object json)` Validate the json performing a synchronous validation.
    `void` | `validateSync(ValidatorContext context, Object in)` Validate the provided value

    - ### Methods inherited from class io.vertx.json.schema.common.BaseMutableStateValidator

      `checkSync, getParent, getPriority, initializeIsSync, isSync, validateSyncAsAsync`

    - ### 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.Schema

      `isSync`

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

      `isSync`

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

      `getPriority`

- - ### Field Detail

    - #### shouldRecordContext

          protected boolean shouldRecordContext

  - ### Constructor Detail

    - #### SchemaImpl

          public SchemaImpl(JsonObject schema,
                            JsonPointer scope,
                            MutableStateValidator parent)

  - ### Method Detail

    - #### validateAsync

          public Future<Void> validateAsync(Object json)

      Description copied from interface: `Schema`
      Validate the json performing an asynchronous validation.

      Note: If the schema is synchronous, this method will call internally `this#validateSync(Object)`

      Specified by:
        `validateAsync` in interface `Schema`
      Parameters:
        `json` - input to validate
      Returns:
        a failed future with `ValidationException` if json doesn't match the schema, otherwise a succeeded future.

    - #### validateSync

          public void validateSync(Object json)
                            throws ValidationException,
                                   NoSyncValidationException

      Description copied from interface: `Schema`
      Validate the json performing a synchronous validation. Throws a `ValidationException` if json doesn't match the schema.
      Specified by:
        `validateSync` in interface `Schema`
      Parameters:
        `json` - input to validate
      Throws:
        `ValidationException` - if the input doesn't match the schema
        `NoSyncValidationException` - If the schema cannot perform a synchronous validation

    - #### getScope

          public JsonPointer getScope()

      Specified by:
        `getScope` in interface `Schema`
      Returns:
        scope of this schema

    - #### getJson

          public JsonObject getJson()

      Specified by:
        `getJson` in interface `Schema`
      Returns:
        Json representation of the schema

    - #### getOrApplyDefaultAsync

          public Future<Object> getOrApplyDefaultAsync(Object input)

      Specified by:
        `getOrApplyDefaultAsync` in interface `SchemaInternal`

    - #### getOrApplyDefaultSync

          public Object getOrApplyDefaultSync(Object input)

      Specified by:
        `getOrApplyDefaultSync` in interface `SchemaInternal`

    - #### triggerUpdateIsSync

          public void triggerUpdateIsSync()

      Description copied from interface: `MutableStateValidator`
      Manually trigger the sync state update
      Specified by:
        `triggerUpdateIsSync` in interface `MutableStateValidator`
      Overrides:
        `triggerUpdateIsSync` in class `BaseMutableStateValidator`

    - #### validateAsync

          public Future<Void> validateAsync(ValidatorContext context,
                                            Object in)

      Description copied from interface: `AsyncValidator`
      Return a Future that succeed when the validation succeed, while fail with a `ValidationException` when validation fails
      Specified by:
        `validateAsync` in interface `AsyncValidator`
      Returns:

    - #### validateSync

          public void validateSync(ValidatorContext context,
                                   Object in)
                            throws ValidationException,
                                   NoSyncValidationException

      Description copied from interface: `SyncValidator`
      Validate the provided value
      Specified by:
        `validateSync` in interface `SyncValidator`
      Throws:
        `ValidationException` - if the object is not valid
        `NoSyncValidationException` - if no sync validation can be provided

    - #### calculateIsSync

          public boolean calculateIsSync()

      Specified by:
        `calculateIsSync` in class `BaseMutableStateValidator`

    - #### generateValidationContext

          protected ValidatorContext generateValidationContext(ValidatorContext parent)

    - #### runAsyncValidators

          protected Future<Void> runAsyncValidators(ValidatorContext context,
                                                    Object in)

    - #### runSyncValidator

          protected void runSyncValidator(ValidatorContext context,
                                          Object in)

Copyright © 2021 Eclipse. All rights reserved.