Package org.apache.avro
Interface SchemaFormatterFactory
- All Known Implementing Classes:
- CanonicalSchemaFormatterFactory,- IdlSchemaFormatterFactory,- JsonSchemaFormatterFactory
public interface SchemaFormatterFactory
Service Provider Interface (SPI) for 
SchemaFormatter.
 Notes to implementers:
- Implementations are located using a ServiceLoader. See that class for details.
- Implementing classes should either be named
 <format>SchemaFormatterFactory(where the format is alphanumeric), or implementformatName().
- Implement at least getDefaultFormatter(); use it to callgetFormatterForVariant(String)if the format supports multiple variants.
- Example implementations are JsonSchemaFormatterFactoryandCanonicalSchemaFormatterFactory
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondefault StringReturn the name of the format this formatter factory supports.Get the default formatter for this schema format.default SchemaFormattergetFormatterForVariant(String variantName) Get a formatter for the specified schema format variant, if multiple variants are supported.
- 
Method Details- 
formatNameReturn 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 namedsome.package.JsonSchemaFormatterFactory, it returns: "json"- Returns:
- the name of the format
 
- 
getDefaultFormatterSchemaFormatter 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
 
- 
getFormatterForVariantGet 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; nullotherwise
 
 
-