} else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg);
@Override public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; } else if (in.getCurrentToken() == JsonToken.START_OBJECT && in.nextToken() == JsonToken.FIELD_NAME) { label = in.getText(); in.nextToken(); parser.pushSymbol(Symbol.UNION_END); } else { throw error("start-union"); } int n = a.findLabel(label); if (n < 0) throw new AvroTypeException("Unknown union branch " + label); parser.pushSymbol(a.getSymbol(n)); return n; }
@Override public void writeIndex(int unionIndex) throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative top = (Symbol.Alternative) parser.popSymbol(); Symbol symbol = top.getSymbol(unionIndex); if (symbol != Symbol.NULL) { out.writeStartObject(); out.writeFieldName(top.getLabel(unionIndex)); parser.pushSymbol(Symbol.UNION_END); } parser.pushSymbol(symbol); }
} else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg);
} else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg);
} else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg);
} else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg);
@Override public void skipAction() throws IOException { Symbol top = parser.popSymbol(); if (top instanceof Symbol.ResolvingAction) { parser.pushSymbol(((Symbol.ResolvingAction) top).writer); } else if (top instanceof Symbol.SkipAction) { parser.pushSymbol(((Symbol.SkipAction) top).symToSkip); } else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg); } else if (top instanceof Symbol.DefaultStartAction) { Symbol.DefaultStartAction dsa = (Symbol.DefaultStartAction) top; backup = in; in = DecoderFactory.get() .binaryDecoder(dsa.contents, null); } else if (top == Symbol.DEFAULT_END_ACTION) { in = backup; } } }
@Override public void skipAction() throws IOException { Symbol top = parser.popSymbol(); if (top instanceof Symbol.ResolvingAction) { parser.pushSymbol(((Symbol.ResolvingAction) top).writer); } else if (top instanceof Symbol.SkipAction) { parser.pushSymbol(((Symbol.SkipAction) top).symToSkip); } else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg); } else if (top instanceof Symbol.DefaultStartAction) { Symbol.DefaultStartAction dsa = (Symbol.DefaultStartAction) top; backup = in; in = DecoderFactory.get() .binaryDecoder(dsa.contents, null); } else if (top == Symbol.DEFAULT_END_ACTION) { in = backup; } } }
@Override public void skipAction() throws IOException { Symbol top = parser.popSymbol(); if (top instanceof Symbol.ResolvingAction) { parser.pushSymbol(((Symbol.ResolvingAction) top).writer); } else if (top instanceof Symbol.SkipAction) { parser.pushSymbol(((Symbol.SkipAction) top).symToSkip); } else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg); } else if (top instanceof Symbol.DefaultStartAction) { Symbol.DefaultStartAction dsa = (Symbol.DefaultStartAction) top; backup = in; in = DecoderFactory.defaultFactory() .createBinaryDecoder(dsa.contents, null); } else if (top == Symbol.DEFAULT_END_ACTION) { in = backup; } } }
@Override public void skipAction() throws IOException { Symbol top = parser.popSymbol(); if (top instanceof Symbol.ResolvingAction) { parser.pushSymbol(((Symbol.ResolvingAction) top).writer); } else if (top instanceof Symbol.SkipAction) { parser.pushSymbol(((Symbol.SkipAction) top).symToSkip); } else if (top instanceof Symbol.WriterUnionAction) { Symbol.Alternative branches = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(branches.getSymbol(in.readIndex())); } else if (top instanceof Symbol.ErrorAction) { throw new AvroTypeException(((Symbol.ErrorAction) top).msg); } else if (top instanceof Symbol.DefaultStartAction) { Symbol.DefaultStartAction dsa = (Symbol.DefaultStartAction) top; backup = in; in = DecoderFactory.defaultFactory() .createBinaryDecoder(dsa.contents, null); } else if (top == Symbol.DEFAULT_END_ACTION) { in = backup; } } }
@Override public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; } else if (in.getCurrentToken() == JsonToken.START_OBJECT && in.nextToken() == JsonToken.FIELD_NAME) { label = in.getText(); in.nextToken(); parser.pushSymbol(Symbol.UNION_END); } else { throw error("start-union"); } int n = a.findLabel(label); if (n < 0) throw new AvroTypeException("Unknown union branch " + label); parser.pushSymbol(a.getSymbol(n)); return n; }
@Override public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; } else if (in.getCurrentToken() == JsonToken.START_OBJECT && in.nextToken() == JsonToken.FIELD_NAME) { label = in.getText(); in.nextToken(); parser.pushSymbol(Symbol.UNION_END); } else { throw error("start-union"); } int n = a.findLabel(label); if (n < 0) throw new AvroTypeException("Unknown union branch " + label); parser.pushSymbol(a.getSymbol(n)); return n; }
@Override public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; } else if (in.getCurrentToken() == JsonToken.START_OBJECT && in.nextToken() == JsonToken.FIELD_NAME) { label = in.getText(); in.nextToken(); parser.pushSymbol(Symbol.UNION_END); } else { throw error("start-union"); } int n = a.findLabel(label); if (n < 0) throw new AvroTypeException("Unknown union branch " + label); parser.pushSymbol(a.getSymbol(n)); return n; }
@Override public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; } else if (in.getCurrentToken() == JsonToken.START_OBJECT && in.nextToken() == JsonToken.FIELD_NAME) { label = in.getText(); in.nextToken(); parser.pushSymbol(Symbol.UNION_END); } else { throw error("start-union"); } int n = a.findLabel(label); if (n < 0) throw new AvroTypeException("Unknown union branch " + label); parser.pushSymbol(a.getSymbol(n)); return n; }
@Override public int readIndex() throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); String label = csvReader.getElement().toString(); parser.pushSymbol(Symbol.UNION_END); int n = a.findLabel(label); if (n < 0) { throw new AvroTypeException("Unknown union branch " + label); } parser.pushSymbol(a.getSymbol(n)); parseNextCsv(); return n; }
@Override public void writeIndex(int unionIndex) throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative top = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(top.getSymbol(unionIndex)); out.writeIndex(unionIndex); }
@Override public int readIndex() throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative top = (Symbol.Alternative) parser.popSymbol(); int result = in.readIndex(); parser.pushSymbol(top.getSymbol(result)); return result; }
@Override public int readIndex() throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative top = (Symbol.Alternative) parser.popSymbol(); int result = in.readIndex(); parser.pushSymbol(top.getSymbol(result)); return result; }
@Override public void writeIndex(int unionIndex) throws IOException { parser.advance(Symbol.UNION); Symbol.Alternative top = (Symbol.Alternative) parser.popSymbol(); parser.pushSymbol(top.getSymbol(unionIndex)); out.writeIndex(unionIndex); }