org.apache.avro

## 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 Summary

Constructors
Constructor and Description
`Parser()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Schema.Parser` `addTypes(Map<String,Schema> types)` Adds the provided types to the set of defined, named types known to this parser.
`Map<String,Schema>` `getTypes()` Returns the set of defined, named types known to this parser.
`boolean` `getValidate()` True iff names are validated.
`boolean` `getValidateDefaults()` True iff default values are validated.
`Schema` `parse(File file)` Parse a schema from the provided file.
`Schema` `parse(InputStream in)` Parse a schema from the provided stream.
`Schema` `parse(String s)` Parse a schema from the provided string.
`Schema` `parse(String s, String... more)` Read a schema from one or more json strings
`Schema.Parser` `setValidate(boolean validate)` Enable or disable name validation.
`Schema.Parser` `setValidateDefaults(boolean validateDefaults)` Enable or disable default value validation.

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

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

### Constructor Detail

#### Parser

    public Parser()

### Method Detail

#### addTypes

    public Schema.Parser addTypes(Map<String,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.

#### setValidate

    public Schema.Parser setValidate(boolean validate)

Enable or disable name validation.

#### getValidate

    public boolean getValidate()

True iff names are validated. True by default.

#### 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.