Class Schema.Parser

java.lang.Object
org.apache.avro.Schema.Parser
Enclosing class:
Schema

public static class Schema.Parser extends Object
A parser for JSON-format schemas. Each named schema parsed with a parser is added to the names known to the parser so that subsequently parsed schemas may refer to it by name.
  • Constructor Details

  • Method Details

    • addTypes

      @Deprecated public Schema.Parser addTypes(Map<String,Schema> types)
      Deprecated.
      use addTypes(Iterable types)
      Adds the provided types to the set of defined, named types known to this parser.
    • addTypes

      public Schema.Parser addTypes(Iterable<Schema> types)
      Adds the provided types to the set of defined, named types known to this parser.
    • getTypes

      public Map<String,Schema> getTypes()
      Returns the set of defined, named types known to this parser.
    • setValidateDefaults

      public Schema.Parser setValidateDefaults(boolean validateDefaults)
      Enable or disable default value validation.
    • getValidateDefaults

      public boolean getValidateDefaults()
      True iff default values are validated. False by default.
    • parse

      public Schema parse(File file) throws IOException
      Parse a schema from the provided file. If named, the schema is added to the names known to this parser.
      Throws:
      IOException
    • parse

      public Schema parse(InputStream in) throws IOException
      Parse a schema from the provided stream. If named, the schema is added to the names known to this parser. The input stream stays open after the parsing.
      Throws:
      IOException
    • parse

      public Schema parse(String s, String... more)
      Read a schema from one or more json strings
    • parse

      public Schema parse(String s)
      Parse a schema from the provided string. If named, the schema is added to the names known to this parser.
    • parseInternal

      public Schema parseInternal(String s)