org.apache.avro.compiler.idl
Class Idl

java.lang.Object
  extended by org.apache.avro.compiler.idl.Idl
All Implemented Interfaces:
IdlConstants

public class Idl
extends Object
implements IdlConstants

Grammar to parse a higher-level language into an Avro Schema. Note: each instance is not thread-safe, but multiple separate instances are safely independent.


Field Summary
 Token jj_nt
          Next token.
 Token token
          Current token.
 IdlTokenManager token_source
          Generated Token Manager.
 
Fields inherited from interface org.apache.avro.compiler.idl.IdlConstants
ARRAY, AT, BOOLEAN, BYTES, CHARACTER_LITERAL, COLON, COMMA, DECIMAL_EXPONENT, DECIMAL_FLOATING_POINT_LITERAL, DECIMAL_LITERAL, DEFAULT, DOC_COMMENT, DOT, DOUBLE, ENUM, EOF, EQUALS, ERROR, FALSE, FIXED, FLOAT, FLOATING_POINT_LITERAL, GT, HEX_LITERAL, HEXADECIMAL_EXPONENT, HEXADECIMAL_FLOATING_POINT_LITERAL, IDENTIFIER, IDL, IMPORT, INT, INTEGER_LITERAL, LBRACE, LBRACK, LETTER, LONG, LPAREN, LT, MAP, MULTI_LINE_COMMENT, NULL, OCTAL_LITERAL, ONEWAY, PART_LETTER, PROTOCOL, RBRACE, RBRACK, RECORD, RPAREN, SCHEMA, SEMICOLON, SINGLE_LINE_COMMENT, STRING, STRING_LITERAL, STUFF_TO_IGNORE, THROWS, TICK, tokenImage, TRUE, UNION, VOID
 
Constructor Summary
Idl(File inputFile)
           
Idl(IdlTokenManager tm)
          Constructor with generated Token Manager.
Idl(InputStream stream)
          Constructor with InputStream.
Idl(InputStream stream, String encoding)
          Constructor with InputStream and supplied encoding
Idl(Reader stream)
          Constructor.
 
Method Summary
 Token AnyIdentifier()
           
 Schema ArrayType()
           
 Protocol CompilationUnit()
          The input to Idl is a CompilationUnit, which is currently just a single Protocol.
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 List<String> EnumBody()
           
 void EnumConstant(List<String> symbols)
           
 Schema EnumDeclaration()
           
 void ErrorList(List<Schema> errors)
           
 void FieldDeclaration(List<Schema.Field> fields)
           
 Schema FixedDeclaration()
           
 void FormalParameter(List<Schema.Field> fields)
           
 Schema FormalParameters()
           
 ParseException generateParseException()
          Generate ParseException.
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 String Identifier()
           
 Protocol ImportIdl()
           
 Protocol ImportProtocol()
           
 Schema ImportSchema()
           
 JsonNode Json()
           
 JsonNode JsonArray()
           
 void JsonElements(ArrayNode a)
           
 void JsonFields(ObjectNode o)
           
 JsonNode JsonObject()
           
 void JsonPair(ObjectNode o)
           
 String JsonString()
           
 Schema MapType()
           
 Protocol.Message MessageDeclaration(Protocol p)
           
 Schema NamedSchemaDeclaration()
           
 Schema PrimitiveType()
           
 void ProtocolBody(Protocol p)
           
 Protocol ProtocolDeclaration()
           
 Schema RecordDeclaration()
           
 Schema ReferenceType()
          A reference to some other existing type
 void ReInit(IdlTokenManager tm)
          Reinitialise.
 void ReInit(InputStream stream)
          Reinitialise.
 void ReInit(InputStream stream, String encoding)
          Reinitialise.
 void ReInit(Reader stream)
          Reinitialise.
 Schema ResultType()
          Result types are like other types, except we provide "void" as an alias of "null"
 void SchemaProperty(Map<String,JsonNode> properties)
           
 Schema Type()
           
 Schema UnionDefinition()
           
 void VariableDeclarator(Schema type, List<Schema.Field> fields)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public IdlTokenManager token_source
Generated Token Manager.


token

public Token token
Current token.


jj_nt

public Token jj_nt
Next token.

Constructor Detail

Idl

public Idl(File inputFile)
    throws IOException
Throws:
IOException

Idl

public Idl(InputStream stream)
Constructor with InputStream.


Idl

public Idl(InputStream stream,
           String encoding)
Constructor with InputStream and supplied encoding


Idl

public Idl(Reader stream)
Constructor.


Idl

public Idl(IdlTokenManager tm)
Constructor with generated Token Manager.

Method Detail

CompilationUnit

public final Protocol CompilationUnit()
                               throws ParseException
The input to Idl is a CompilationUnit, which is currently just a single Protocol.

Throws:
ParseException

NamedSchemaDeclaration

public final Schema NamedSchemaDeclaration()
                                    throws ParseException
Throws:
ParseException

UnionDefinition

public final Schema UnionDefinition()
                             throws ParseException
Throws:
ParseException

ProtocolDeclaration

public final Protocol ProtocolDeclaration()
                                   throws ParseException
Throws:
ParseException

EnumDeclaration

public final Schema EnumDeclaration()
                             throws ParseException
Throws:
ParseException

EnumBody

public final List<String> EnumBody()
                            throws ParseException
Throws:
ParseException

EnumConstant

public final void EnumConstant(List<String> symbols)
                        throws ParseException
Throws:
ParseException

ProtocolBody

public final void ProtocolBody(Protocol p)
                        throws ParseException
Throws:
ParseException

ImportIdl

public final Protocol ImportIdl()
                         throws ParseException
Throws:
ParseException

ImportProtocol

public final Protocol ImportProtocol()
                              throws ParseException
Throws:
ParseException

ImportSchema

public final Schema ImportSchema()
                          throws ParseException
Throws:
ParseException

FixedDeclaration

public final Schema FixedDeclaration()
                              throws ParseException
Throws:
ParseException

RecordDeclaration

public final Schema RecordDeclaration()
                               throws ParseException
Throws:
ParseException

SchemaProperty

public final void SchemaProperty(Map<String,JsonNode> properties)
                          throws ParseException
Throws:
ParseException

FieldDeclaration

public final void FieldDeclaration(List<Schema.Field> fields)
                            throws ParseException
Throws:
ParseException

VariableDeclarator

public final void VariableDeclarator(Schema type,
                                     List<Schema.Field> fields)
                              throws ParseException
Throws:
ParseException

MessageDeclaration

public final Protocol.Message MessageDeclaration(Protocol p)
                                          throws ParseException
Throws:
ParseException

ErrorList

public final void ErrorList(List<Schema> errors)
                     throws ParseException
Throws:
ParseException

FormalParameters

public final Schema FormalParameters()
                              throws ParseException
Throws:
ParseException

FormalParameter

public final void FormalParameter(List<Schema.Field> fields)
                           throws ParseException
Throws:
ParseException

Type

public final Schema Type()
                  throws ParseException
Throws:
ParseException

ArrayType

public final Schema ArrayType()
                       throws ParseException
Throws:
ParseException

MapType

public final Schema MapType()
                     throws ParseException
Throws:
ParseException

ReferenceType

public final Schema ReferenceType()
                           throws ParseException
A reference to some other existing type

Throws:
ParseException

PrimitiveType

public final Schema PrimitiveType()
                           throws ParseException
Throws:
ParseException

ResultType

public final Schema ResultType()
                        throws ParseException
Result types are like other types, except we provide "void" as an alias of "null"

Throws:
ParseException

Identifier

public final String Identifier()
                        throws ParseException
Throws:
ParseException

AnyIdentifier

public final Token AnyIdentifier()
                          throws ParseException
Throws:
ParseException

Json

public final JsonNode Json()
                    throws ParseException
Throws:
ParseException

JsonString

public final String JsonString()
                        throws ParseException
Throws:
ParseException

JsonObject

public final JsonNode JsonObject()
                          throws ParseException
Throws:
ParseException

JsonFields

public final void JsonFields(ObjectNode o)
                      throws ParseException
Throws:
ParseException

JsonPair

public final void JsonPair(ObjectNode o)
                    throws ParseException
Throws:
ParseException

JsonArray

public final JsonNode JsonArray()
                         throws ParseException
Throws:
ParseException

JsonElements

public final void JsonElements(ArrayNode a)
                        throws ParseException
Throws:
ParseException

ReInit

public void ReInit(InputStream stream)
Reinitialise.


ReInit

public void ReInit(InputStream stream,
                   String encoding)
Reinitialise.


ReInit

public void ReInit(Reader stream)
Reinitialise.


ReInit

public void ReInit(IdlTokenManager tm)
Reinitialise.


getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.



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