org.apache.avro
Class Schema.Parser

java.lang.Object
  extended by 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
Schema.Parser()
           
 
Method Summary
 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.
 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.Parser setValidate(boolean validate)
          Enable or disable name validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema.Parser

public Schema.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.


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.

Throws:
IOException

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.



Copyright © 2011 The Apache Software Foundation. All Rights Reserved.