当前位置: 首页>>代码示例>>Java>>正文


Java Symbol.FIELD_END属性代码示例

本文整理汇总了Java中org.apache.avro.io.parsing.Symbol.FIELD_END属性的典型用法代码示例。如果您正苦于以下问题:Java Symbol.FIELD_END属性的具体用法?Java Symbol.FIELD_END怎么用?Java Symbol.FIELD_END使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.avro.io.parsing.Symbol的用法示例。


在下文中一共展示了Symbol.FIELD_END属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doAction

@Override
public Symbol doAction(Symbol input, Symbol top) throws IOException {
  if (top instanceof Symbol.FieldAdjustAction) {
    Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top;
    out.writeFieldName(fa.fname);
  } else if (top == Symbol.RECORD_START) {
    out.writeStartObject();
  } else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) {
    out.writeEndObject();
  } else if (top != Symbol.FIELD_END) {
    throw new AvroTypeException("Unknown action symbol " + top);
  }
  return null;
}
 
开发者ID:HotelsDotCom,项目名称:jasvorno,代码行数:14,代码来源:JasvornoEncoder.java

示例2: doAction

@Override
public Symbol doAction(Symbol input, Symbol top) throws IOException {
	if (top instanceof Symbol.FieldAdjustAction) {
		Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top;
		String name = fa.fname;
		if (currentReorderBuffer != null) {
			List<JsonElement> node = currentReorderBuffer.savedFields.get(name);
			if (node != null) {
				currentReorderBuffer.savedFields.remove(name);
				currentReorderBuffer.origParser = in;
				in = makeParser(node);
				return null;
			}
		}
		if (in.getCurrentToken() == JsonToken.FIELD_NAME) {
			do {
				String fn = in.getText();
				in.nextToken();
				if (name.equals(fn)) {
					return null;
				} else {
					if (currentReorderBuffer == null) {
						currentReorderBuffer = new ReorderBuffer();
					}
					currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in));
				}
			} while (in.getCurrentToken() == JsonToken.FIELD_NAME);
			injectDefaultValueIfAvailable(in, fa.fname);
		} else {
			injectDefaultValueIfAvailable(in, fa.fname);
		}
	} else if (top == Symbol.FIELD_END) {
		if (currentReorderBuffer != null && currentReorderBuffer.origParser != null) {
			in = currentReorderBuffer.origParser;
			currentReorderBuffer.origParser = null;
		}
	} else if (top == Symbol.RECORD_START) {
		if (in.getCurrentToken() == JsonToken.START_OBJECT) {
			in.nextToken();
			reorderBuffers.push(currentReorderBuffer);
			currentReorderBuffer = null;
		} else {
			throw error("record-start");
		}
	} else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) {
		if (in.getCurrentToken() == JsonToken.END_OBJECT) {
			in.nextToken();
			if (top == Symbol.RECORD_END) {
				if (currentReorderBuffer != null && !currentReorderBuffer.savedFields.isEmpty()) {
					throw error("Unknown fields: " + currentReorderBuffer.savedFields.keySet());
				}
				currentReorderBuffer = reorderBuffers.pop();
			}
		} else {
			throw error(top == Symbol.RECORD_END ? "record-end" : "union-end");
		}
	} else {
		throw new AvroTypeException("Unknown action symbol " + top);
	}
	return null;
}
 
开发者ID:Celos,项目名称:avro-json-decoder,代码行数:61,代码来源:ExtendedJsonDecoder.java

示例3: doAction

@Override
public Symbol doAction(Symbol input, Symbol top) throws IOException {
  if (top instanceof Symbol.FieldAdjustAction) {
      Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top;
      String name = fa.fname;
    if (currentReorderBuffer != null) {
      List<JsonElement> node = currentReorderBuffer.savedFields.get(name);
      if (node != null) {
        currentReorderBuffer.savedFields.remove(name);
        currentReorderBuffer.origParser = in;
        in = makeParser(node);
        return null;
      }
    }
    if (in.getCurrentToken() == JsonToken.FIELD_NAME) {
      do {
        String fn = in.getText();
        in.nextToken();
        if (name.equals(fn)) {
          return null;
        } else {
          if (currentReorderBuffer == null) {
            currentReorderBuffer = new ReorderBuffer();
          }
          currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in));
        }
      } while (in.getCurrentToken() == JsonToken.FIELD_NAME);
      throw new AvroTypeException("Expected field name not found: " + fa.fname);
    }
  } else if (top == Symbol.FIELD_END) {
    if (currentReorderBuffer != null && currentReorderBuffer.origParser != null) {
      in = currentReorderBuffer.origParser;
      currentReorderBuffer.origParser = null;
    }
  } else if (top == Symbol.RECORD_START) {
    if (in.getCurrentToken() == JsonToken.START_OBJECT) {
      in.nextToken();
      reorderBuffers.push(currentReorderBuffer);
      currentReorderBuffer = null;
    } else {
      throw error("record-start");
    }
  } else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) {
    if (in.getCurrentToken() == JsonToken.END_OBJECT) {
      in.nextToken();
      if (top == Symbol.RECORD_END) {
        if (currentReorderBuffer != null && !currentReorderBuffer.savedFields.isEmpty()) {
          throw error("Unknown fields: " + currentReorderBuffer.savedFields.keySet());
        }
        currentReorderBuffer = reorderBuffers.pop();
      }
    } else {
      throw error(top == Symbol.RECORD_END ? "record-end" : "union-end");
    }
  } else {
    throw new AvroTypeException("Unknown action symbol " + top);
  }
  return null;
}
 
开发者ID:openaire,项目名称:iis,代码行数:59,代码来源:HackedJsonDecoder.java

示例4: doAction

@Override
public Symbol doAction(Symbol input, Symbol top) throws IOException {


    if (top instanceof Symbol.FieldAdjustAction) {
        Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top;
        String name = fa.fname;
        if (currentReorderBuffer != null) {
            List<JsonElement> node = currentReorderBuffer.savedFields.get(name);
            if (node != null) {
                currentReorderBuffer.savedFields.remove(name);
                currentReorderBuffer.origParser = in;
                in = makeParser(node);
                return null;
            }
        }
        if (in.getCurrentToken() == JsonToken.FIELD_NAME) {
            do {
                String fn = in.getText();
                in.nextToken();
                if (name.equals(fn)) {
                    return null;
                } else {
                    if (currentReorderBuffer == null) {
                        currentReorderBuffer = new ReorderBuffer();
                    }
                    currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in));
                }
            } while (in.getCurrentToken() == JsonToken.FIELD_NAME);
            throw new AvroTypeException("Expected field name not found: " + fa.fname);
        }
    } else if (top == Symbol.FIELD_END) {
        if (currentReorderBuffer != null && currentReorderBuffer.origParser != null) {
            in = currentReorderBuffer.origParser;
            currentReorderBuffer.origParser = null;
        }
    } else if (top == Symbol.RECORD_START) {
        if (in.getCurrentToken() == JsonToken.START_OBJECT) {
            in.nextToken();
            reorderBuffers.push(currentReorderBuffer);
            currentReorderBuffer = null;
        } else {
            throw error("record-start");
        }
    } else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) {
        if (in.getCurrentToken() == JsonToken.END_OBJECT) {
            in.nextToken();
            if (top == Symbol.RECORD_END) {
                if (currentReorderBuffer != null && !currentReorderBuffer.savedFields.isEmpty()) {
                    throw error("Unknown fields: " + currentReorderBuffer.savedFields.keySet());
                }
                currentReorderBuffer = reorderBuffers.pop();
            }
        } else {
            throw error(top == Symbol.RECORD_END ? "record-end" : "union-end");
        }
    } else {
        throw new AvroTypeException("Unknown action symbol " + top);
    }
    return null;
}
 
开发者ID:whale2,项目名称:iow-hadoop-streaming,代码行数:61,代码来源:IOWJsonDecoder.java


注:本文中的org.apache.avro.io.parsing.Symbol.FIELD_END属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。