Package 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
Description
`Parser()`
`Parser(NameValidator validate)`
`Parser(ParseContext context)`

## Method Summary

Modifier and Type
Method
Description
`Schema.Parser`
`addTypes(Iterable<Schema> types)`
Adds the provided types to the set of defined, named types known to this parser.
`Schema.Parser`
`addTypes(Map<String,Schema> types)`
Deprecated.
use addTypes(Iterable<Schema> types)
`Map<String,Schema>`
`getTypes()`
Returns the set of defined, named types known to this parser.
`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`
`parseInternal(String s)`
`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 Details

### Parser

public Parser()

### Parser

public Parser(NameValidator validate)

### Parser

public Parser(ParseContext context)

## Method Details

### addTypes

@Deprecated public Schema.Parser addTypes(Map<String,Schema> types)
Deprecated.
use addTypes(Iterable<Schema> 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)