Interface ISchemaGenerator

All Known Implementing Classes:
AbstractSchemaGenerator, JsonSchemaGenerator, XmlSchemaGenerator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ISchemaGenerator
Provides the capability to generate a schema from a Metaschema module.
  • Method Details

    • generateFromModule

      void generateFromModule(@NonNull IModule metaschema, @NonNull Writer writer, @NonNull IConfiguration<SchemaGenerationFeature<?>> configuration)
      Generate and write a schema for the provided metaschema to the Writer provided by writer using the provided configuration.
      Parameters:
      metaschema - the Module to generate the schema for
      writer - the writer to use to write the schema
      configuration - the schema generation configuration
      Throws:
      SchemaGenerationException - if an error occurred while writing the schema
    • generateSchema

      static void generateSchema(@NonNull IModule module, @NonNull Path destination, @NonNull ISchemaGenerator.SchemaFormat asFormat, @NonNull IConfiguration<SchemaGenerationFeature<?>> configuration) throws IOException
      Generate a schema for the provided module and write it to the specified file path.
      Parameters:
      module - the Metaschema module to generate the schema for
      destination - the file path to write the schema to
      asFormat - the schema format to generate
      configuration - the schema generation configuration
      Throws:
      IOException - if an I/O error occurs while writing the schema
    • generateSchema

      static void generateSchema(@NonNull IModule module, @NonNull Writer writer, @NonNull ISchemaGenerator.SchemaFormat asFormat, @NonNull IConfiguration<SchemaGenerationFeature<?>> configuration) throws IOException
      Generate a schema for the provided module and write it to the specified writer.

      The writer is not closed by this method, as the caller is responsible for managing its lifecycle.

      Parameters:
      module - the Metaschema module to generate the schema for
      writer - the writer to output the schema to
      asFormat - the schema format to generate
      configuration - the schema generation configuration
      Throws:
      IOException - if an I/O error occurs while writing the schema