Interface SchemaFormatterFactory

All Known Implementing Classes:
CanonicalSchemaFormatterFactory, IdlSchemaFormatterFactory, JsonSchemaFormatterFactory

public interface SchemaFormatterFactory
Service Provider Interface (SPI) for SchemaFormatter.

Notes to implementers:

See Also:
  • Method Details

    • formatName

      default String formatName()
      Return the name of the format this formatter factory supports.

      The default implementation returns the lowercase prefix of the implementing class if it is named <format>SchemaFormatterFactory. That is, if the implementing class is named some.package.JsonSchemaFormatterFactory, it returns: "json"

      Returns:
      the name of the format
    • getDefaultFormatter

      SchemaFormatter getDefaultFormatter()
      Get the default formatter for this schema format. Instances should be thread-safe, as they may be cached.

      Implementations should either return the only formatter for this format, or call getFormatterForVariant(String) with the default variant and implement that method as well.

      Returns:
      the default formatter for this schema format
    • getFormatterForVariant

      default SchemaFormatter getFormatterForVariant(String variantName)
      Get a formatter for the specified schema format variant, if multiple variants are supported. Instances should be thread-safe, as they may be cached.
      Parameters:
      variantName - the name of the format variant (lower case), if specified
      Returns:
      if the factory supports the format, a schema writer; null otherwise