@Override public void key(String key) throws IOException { DataSchema newSchema = null; if (_currentSchema != null) { switch (_currentSchema.getType()) { case RECORD: RecordDataSchema recordSchema = (RecordDataSchema) _currentSchema; RecordDataSchema.Field field = recordSchema.getField(key); if (field != null) { newSchema = field.getType(); } break; case UNION: UnionDataSchema unionSchema = (UnionDataSchema) _currentSchema; newSchema = unionSchema.getType(key); break; case MAP: MapDataSchema mapSchema = (MapDataSchema) _currentSchema; newSchema = mapSchema.getValues(); break; } } _pendingSchema = newSchema; super.key(key); }
@Override public void index(int index) { DataSchema newSchema = null; if (_currentSchema != null && _currentSchema.getType() == DataSchema.Type.ARRAY) { ArrayDataSchema arraySchema = (ArrayDataSchema) _currentSchema; newSchema = arraySchema.getItems(); } _pendingSchema = newSchema; super.index(index); }
@Override public void endList() throws IOException { super.endList(); pop(); }
@Override public void startList(DataList list) throws IOException { push(); super.startList(list); }
@Override public void emptyList() throws IOException { simpleValue(); super.emptyList(); }
@Override public void startMap(DataMap map) throws IOException { push(); super.startMap(map); }
@Override public void byteStringValue(ByteString value) throws IOException { simpleValue(); super.byteStringValue(value); }
@Override public void illegalValue(Object value) throws DataEncodingException { super.illegalValue(value); }
@Override public void doubleValue(double value) throws IOException { simpleValue(); super.doubleValue(value); }
@Override public void stringValue(String value) throws IOException { simpleValue(); super.stringValue(value); }
@Override public void floatValue(float value) throws IOException { simpleValue(); super.floatValue(value); }
@Override public void longValue(long value) throws IOException { simpleValue(); super.longValue(value); }
@Override public void integerValue(int value) throws IOException { simpleValue(); super.integerValue(value); }
@Override public void booleanValue(boolean value) throws IOException { simpleValue(); super.booleanValue(value); }
@Override public void nullValue() throws IOException { simpleValue(); super.nullValue(); }