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
    --- | ---
    `void` | `applyDefaultValues(JsonArray array)` This function mutates `array` applying default values, when available.
    `void` | `applyDefaultValues(JsonObject object)` This function mutates `object` applying default values, when available.
    `boolean` | `calculateIsSync()`
    `void` | `doApplyDefaultValues(Object obj)`
    `protected ValidatorContext` | `generateValidationContext(ValidatorContext parent)`
    `Object` | `getDefaultValue()` Return the default value defined in the schema
    `JsonObject` | `getJson()` Get Json representation of the schema
    `JsonPointer` | `getScope()` Get scope of this schema
    `boolean` | `hasDefaultValue()` Return true if the schema has a default value defined
    `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. Returns a failed future with `ValidationException` if json doesn't match the schema.

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

      Specified by:
        `validateAsync` in interface `Schema`
      Returns:

    - #### 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`
      Throws:
        `ValidationException`
        `NoSyncValidationException` - If the schema cannot perform a synchronous validation

    - #### getScope

          public JsonPointer getScope()

      Description copied from interface: `Schema`
      Get scope of this schema
      Specified by:
        `getScope` in interface `Schema`
      Returns:

    - #### getJson

          public JsonObject getJson()

      Description copied from interface: `Schema`
      Get Json representation of the schema
      Specified by:
        `getJson` in interface `Schema`
      Returns:

    - #### getDefaultValue

          public Object getDefaultValue()

      Description copied from interface: `Schema`
      Return the default value defined in the schema
      Specified by:
        `getDefaultValue` in interface `Schema`
      Returns:

    - #### hasDefaultValue

          public boolean hasDefaultValue()

      Description copied from interface: `Schema`
      Return true if the schema has a default value defined
      Specified by:
        `hasDefaultValue` in interface `Schema`
      Returns:

    - #### applyDefaultValues

          public void applyDefaultValues(JsonArray array)
                                  throws NoSyncValidationException

      Description copied from interface: `Schema`
      This function mutates `array` applying default values, when available.
      Specified by:
        `applyDefaultValues` in interface `Schema`
      Throws:
        `NoSyncValidationException` - if this schema represents a `$ref` not solved yet

    - #### applyDefaultValues

          public void applyDefaultValues(JsonObject object)
                                  throws NoSyncValidationException

      Description copied from interface: `Schema`
      This function mutates `object` applying default values, when available.
      Specified by:
        `applyDefaultValues` in interface `Schema`
      Throws:
        `NoSyncValidationException` - if this schema represents a `$ref` not solved yet

    - #### doApplyDefaultValues

          public void doApplyDefaultValues(Object obj)

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