org.apache.avro

## Class ValidateLatest

- java.lang.Object
- - org.apache.avro.ValidateLatest

- All Implemented Interfaces:
    SchemaValidator

      public final class ValidateLatest
      extends Object
      implements SchemaValidator

  A `SchemaValidator` for validating the provided schema against the first `Schema` in the iterable in `validate(Schema, Iterable)`.

  Uses the `SchemaValidationStrategy` provided in the constructor to validate the schema against the first Schema in the iterable, if it exists, via `SchemaValidationStrategy.validate(Schema, Schema)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidateLatest(SchemaValidationStrategy strategy)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `validate(Schema toValidate, Iterable<Schema> schemasInOrder)` Validate one schema against others.

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

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

- - ### Constructor Detail

    - #### ValidateLatest

          public ValidateLatest(SchemaValidationStrategy strategy)

      Parameters:
        `strategy` - The strategy to use for validation of pairwise schemas.

  - ### Method Detail

    - #### validate

          public void validate(Schema toValidate,
                               Iterable<Schema> schemasInOrder)
                        throws SchemaValidationException

      Description copied from interface: `SchemaValidator`
      Validate one schema against others. The order of the schemas to validate against is chronological from most recent to oldest, if there is a natural chronological order. This allows some validators to identify which schemas are the most "recent" in order to validate only against the most recent schema(s).
      Specified by:
        `validate` in interface `SchemaValidator`
      Parameters:
        `toValidate` - The schema to validate
        `schemasInOrder` - The schemas to validate against, in order from most recent to latest if applicable
      Throws:
        `SchemaValidationException` - if the schema fails to validate.

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.