Package org.apache.avro

Examples of org.apache.avro.Schema


                                 sb.append(".").append(tok.image);
    }
    String name = sb.toString();
    if ((name.indexOf('.') == -1) && namespace != null)
      name = namespace + "." + name;
    Schema type = names.get(name);
    if (type == null)
      {if (true) throw error("Undefined name '" + name + "'", token);}
    {if (true) return type;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here


/**
* Result types are like other types, except we provide "void" as
* an alias of "null"
*/
  final public Schema ResultType() throws ParseException {
  Schema schema;
    if (jj_2_3(2)) {
      jj_consume_token(VOID);
                      {if (true) return Schema.create(Type.NULL);}
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
View Full Code Here

/*
* Declaration syntax follows.
*/
  final public Schema NamedSchemaDeclaration() throws ParseException {
  Schema s;
  Map<String, JsonNode> props = new LinkedHashMap<String, JsonNode>();
  String savedSpace = this.namespace;
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AT:
        ;
        break;
      default:
        jj_la1[2] = jj_gen;
        break label_1;
      }
      SchemaProperty(props);
    }
    if (props.containsKey("namespace"))
      this.namespace = getTextProp("namespace", props, token);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case FIXED:
      s = FixedDeclaration();
      break;
    case ENUM:
      s = EnumDeclaration();
      break;
    case ERROR:
    case RECORD:
      s = RecordDeclaration();
      break;
    default:
      jj_la1[3] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
   this.namespace = savedSpace;

   for (String key : props.keySet())
     if ("namespace".equals(key)) {               // already handled: ignore
     } else if ("aliases".equals(key)) {          // aliases
       for (String alias : getTextProps("aliases", props, token))
         s.addAlias(alias);
     } else if (props.get(key).isTextual()) {     // ignore other non-textual
       s.addProp(key, getTextProp(key, props, token));
     }

   {if (true) return s;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

   {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

  final public Schema UnionDefinition() throws ParseException {
  Schema s;
  List<Schema> schemata = new ArrayList<Schema>();
    jj_consume_token(UNION);
    jj_consume_token(LBRACE);
    s = Type();
    schemata.add(s);
View Full Code Here

  String name;
  List<String> symbols;
    jj_consume_token(ENUM);
    name = Identifier();
    symbols = EnumBody();
    Schema s = Schema.createEnum(name, getDoc(), this.namespace, symbols);
    names.put(s.getFullName(), s);
    {if (true) return s;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

    sym = Identifier();
                       symbols.add(sym);
  }

  final public void ProtocolBody(Protocol p) throws ParseException {
  Schema schema;
  Message message;
  Protocol importProtocol;
    jj_consume_token(LBRACE);
    label_5:
    while (true) {
View Full Code Here

    importFile = JsonString();
    jj_consume_token(SEMICOLON);
      try {
        Parser parser = new Schema.Parser();
        parser.addTypes(names);                   // inherit names
        Schema value = parser.parse(new File(inputDir, importFile));
        names = parser.getTypes();                // update names
        {if (true) return value;}
      } catch (IOException e) {
        {if (true) throw error("Error importing "+importFile+": "+e, token);}
      }
View Full Code Here

    name = Identifier();
    jj_consume_token(LPAREN);
    sizeTok = jj_consume_token(INTEGER_LITERAL);
    jj_consume_token(RPAREN);
    jj_consume_token(SEMICOLON);
    Schema s = Schema.createFixed(name, getDoc(), this.namespace,
                                  Integer.parseInt(sizeTok.image));
    names.put(s.getFullName(), s);
    {if (true) return s;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

      jj_la1[11] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    name = Identifier();
    Schema result = Schema.createRecord(
      name, getDoc(), this.namespace, isError);
    names.put(result.getFullName(), result);
    jj_consume_token(LBRACE);
    label_6:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case ARRAY:
      case BOOLEAN:
      case DOUBLE:
      case FLOAT:
      case INT:
      case LONG:
      case MAP:
      case BYTES:
      case STRING:
      case NULL:
      case UNION:
      case IDENTIFIER:
      case AT:
      case TICK:
        ;
        break;
      default:
        jj_la1[12] = jj_gen;
        break label_6;
      }
      FieldDeclaration(fields);
    }
    jj_consume_token(RBRACE);
    result.setFields(fields);
    {if (true) return result;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

      {if (true) throw error("Property '" + key + "' already specified", token);}
    properties.put(key, val);
  }

  final public void FieldDeclaration(List<Field> fields) throws ParseException {
  Schema type;
  Map<String, JsonNode> props = new LinkedHashMap<String, JsonNode>();
    label_7:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AT:
        ;
        break;
      default:
        jj_la1[13] = jj_gen;
        break label_7;
      }
      SchemaProperty(props);
    }
    type = Type();
    VariableDeclarator(type, fields);
    label_8:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[14] = jj_gen;
        break label_8;
      }
      jj_consume_token(COMMA);
      VariableDeclarator(type, fields);
    }
    jj_consume_token(SEMICOLON);
    for (String key : props.keySet())
      type.addProp(key, getTextProp(key, props, token));
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.