org.apache.avro.Protocol.addProp()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.avro.Protocol.addProp()方法的一些代码示例,展示了Protocol.addProp()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Protocol.addProp()方法的具体详情如下:
包路径:org.apache.avro.Protocol
类名称:Protocol
方法名:addProp

Protocol.addProp介绍

暂无

代码示例

代码示例来源:origin: apache/avro

private void parseProps(JsonNode json) {
 for (Iterator<String> i = json.fieldNames(); i.hasNext();) {
  String p = i.next();                        // add non-reserved as props
  if (!PROTOCOL_RESERVED.contains(p))
   this.addProp(p, json.get(p));
 }
}

代码示例来源:origin: org.apache.avro/avro

private void parseProps(JsonNode json) {
 for (Iterator<String> i = json.getFieldNames(); i.hasNext();) {
  String p = i.next();                        // add non-reserved as props
  if (!PROTOCOL_RESERVED.contains(p))
   this.addProp(p, json.get(p));
 }
}

代码示例来源:origin: apache/avro

@Test public void testPropEquals() {
 Protocol p1 = new Protocol("P", null, "foo");
 p1.addProp("a","1");
 Protocol p2 = new Protocol("P", null, "foo");
 p2.addProp("a","2");
 assertFalse(p1.equals(p2));
}

代码示例来源:origin: apache/avro

private Protocol addStringType(Protocol p) {
 if (stringType != StringType.String)
  return p;
 Protocol newP = new Protocol(p.getName(), p.getDoc(), p.getNamespace());
 Map<Schema,Schema> types = new LinkedHashMap<>();
 for (Map.Entry<String, Object> a : p.getObjectProps().entrySet()) {
  newP.addProp(a.getKey(), a.getValue());
 }
 // annotate types
 Collection<Schema> namedTypes = new LinkedHashSet<>();
 for (Schema s : p.getTypes())
  namedTypes.add(addStringType(s, types));
 newP.setTypes(namedTypes);
 // annotate messages
 Map<String,Message> newM = newP.getMessages();
 for (Message m : p.getMessages().values())
  newM.put(m.getName(), m.isOneWay()
       ? newP.createMessage(m,
                 addStringType(m.getRequest(), types))
       : newP.createMessage(m,
                 addStringType(m.getRequest(), types),
                 addStringType(m.getResponse(), types),
                 addStringType(m.getErrors(), types)));
 return newP;
}

代码示例来源:origin: apache/avro

@Test
 public void testSplitProtocolBuild() {
  Protocol p = new Protocol("P", null, "foo");
  p.addProp("property", "some value");

  String protocolString = p.toString();
  final int mid = protocolString.length() / 2;
  String[] parts = {
   protocolString.substring(0, mid),
   protocolString.substring(mid),
  };

  Protocol parsedStringProtocol = org.apache.avro.Protocol.parse(protocolString);
  Protocol parsedArrayOfStringProtocol =
   org.apache.avro.Protocol.parse(protocolString.substring(0, mid),
                   protocolString.substring(mid));

  assertNotNull(parsedStringProtocol);
  assertNotNull(parsedArrayOfStringProtocol);
  assertEquals(parsedStringProtocol.toString(), parsedArrayOfStringProtocol.toString());
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro

private void parseProps(JsonNode json) {
 for (Iterator<String> i = json.getFieldNames(); i.hasNext();) {
  String p = i.next();                        // add non-reserved as props
  if (!PROTOCOL_RESERVED.contains(p))
   this.addProp(p, json.get(p));
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private void parseProps(JsonNode json) {
 for (Iterator<String> i = json.getFieldNames(); i.hasNext();) {
  String p = i.next();                        // add non-reserved as props
  if (!PROTOCOL_RESERVED.contains(p))
   this.addProp(p, json.get(p));
 }
}

相关文章