Package org.apache.avro

Examples of org.apache.avro.Schema.addProp()


          Schema result = Schema.create(Schema.Type.BYTES);
          result.addProp(CLASS_PROP, c.getName());
          return result;
        }
        Schema result = Schema.createArray(createSchema(component, names));
        result.addProp(CLASS_PROP, c.getName());
        setElement(result, component);
        return result;
      }
      if (CharSequence.class.isAssignableFrom(c))            // String
        return Schema.create(Schema.Type.STRING);
View Full Code Here


        Union union = c.getAnnotation(Union.class);
        if (union != null) {                                 // union annotated
          return getAnnotatedUnion(union, names);
        } else if (isStringable(c)) {                        // Stringable
          Schema result = Schema.create(Schema.Type.STRING);
          result.addProp(CLASS_PROP, c.getName());
          return result;
        } else if (c.isEnum()) {                             // Enum
          List<String> symbols = new ArrayList<String>();
          Enum[] constants = (Enum[])c.getEnumConstants();
          for (int i = 0; i < constants.length; i++)
View Full Code Here

     if ("namespace".equals(key)) {               // already handled: ignore
     } else if ("aliases".equals(key)) {          // aliases
       for (String alias : getTextProps("aliases", props, token))
         s.addAlias(alias);
     } else {                                     // add all other props
       s.addProp(key, props.get(key));
     }

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

      jj_consume_token(COMMA);
      VariableDeclarator(type, fields);
    }
    jj_consume_token(SEMICOLON);
    for (String key : props.keySet())
      type.addProp(key, props.get(key));
  }

  final public void VariableDeclarator(Schema type, List<Field> fields) throws ParseException {
  String name;
  JsonNode defaultValue = null;
View Full Code Here

        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    for (String key : props.keySet())
      s.addProp(key, props.get(key));
    {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

  final public Schema ArrayType() throws ParseException {
View Full Code Here

     if ("namespace".equals(key)) {               // already handled: ignore
     } else if ("aliases".equals(key)) {          // aliases
       for (String alias : getTextProps("aliases", props, token))
         s.addAlias(alias);
     } else {                                     // add all other props
       s.addProp(key, props.get(key));
     }

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

      jj_consume_token(COMMA);
      VariableDeclarator(type, fields);
    }
    jj_consume_token(SEMICOLON);
    for (String key : props.keySet())
      type.addProp(key, props.get(key));
  }

  final public void VariableDeclarator(Schema type, List<Field> fields) throws ParseException {
  String name;
  JsonNode defaultValue = null;
View Full Code Here

        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    for (String key : props.keySet())
      s.addProp(key, props.get(key));
    {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

  final public Schema ArrayType() throws ParseException {
View Full Code Here

        Type key = params[0];
        Type value = params[1];
        if (!(key == String.class))
          throw new AvroTypeException("Map key class not String: "+key);
        Schema schema = Schema.createMap(createSchema(value, names));
        schema.addProp(CLASS_PROP, raw.getName());
        return schema;
      } else if (Collection.class.isAssignableFrom(raw) ||
          scala.collection.Iterable.class.isAssignableFrom(raw)) {   // Collection
        if (params.length != 1)
          throw new AvroTypeException("No array type specified.");
View Full Code Here

      } else if (Collection.class.isAssignableFrom(raw) ||
          scala.collection.Iterable.class.isAssignableFrom(raw)) {   // Collection
        if (params.length != 1)
          throw new AvroTypeException("No array type specified.");
        Schema schema = Schema.createArray(createSchema(params[0], names));
        schema.addProp(CLASS_PROP, raw.getName());
        return schema;
      } else {
        throw new AvroTypeException("Could not convert type: " + type);
      }
    } else if ((type == Short.class) || (type == Short.TYPE)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.