當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonGenerator.writeEndArray方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.core.JsonGenerator.writeEndArray方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonGenerator.writeEndArray方法的具體用法?Java JsonGenerator.writeEndArray怎麽用?Java JsonGenerator.writeEndArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.core.JsonGenerator的用法示例。


在下文中一共展示了JsonGenerator.writeEndArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toJSONString

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private void toJSONString(String name, ArrowTypeID typeID, List<Field> children, JsonGenerator jsonGenerator) throws IOException {
  jsonGenerator.writeStartObject();
  jsonGenerator.writeFieldName("name");
  jsonGenerator.writeString(name);

  if (typeID != null) {
    jsonGenerator.writeFieldName("type");
    jsonGenerator.writeString(typeID.name());
  }

  if (children != null && children.size() > 0) {
    jsonGenerator.writeFieldName("children");
    jsonGenerator.writeStartArray(children.size());
    for(Field child : children) {
      toJSONString(child.getName(), child.getType().getTypeID(), child.getChildren(), jsonGenerator);
    }
    jsonGenerator.writeEndArray();
  }
  jsonGenerator.writeEndObject();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:21,代碼來源:BatchSchema.java

示例2: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(final EasyForm easyForm,
                      final JsonGenerator jgen,
                      final SerializerProvider serializerProvider) throws IOException {
  synchronized (easyForm) {
    jgen.writeStartObject();
    jgen.writeObjectField("update_time", System.currentTimeMillis());
    jgen.writeObjectField("type", easyForm.getClass().getSimpleName());
    jgen.writeStringField("caption", easyForm.getCaption());
    if (easyForm.hasComponents()) {
      jgen.writeArrayFieldStart("components");
      for (EasyFormComponent component : easyForm.getComponentMap().values()) {
        jgen.writeObject(component);
      }
      if (easyForm.hasSaveValuesButton()) {
        jgen.writeObject(easyForm.getSaveValuesButton());
      }
      if (easyForm.hasLoadValuesButton()) {
        jgen.writeObject(easyForm.getLoadValuesButton());
      }
      jgen.writeEndArray();
    }
    jgen.writeEndObject();
  }
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:26,代碼來源:EasyFormSerializer.java

示例3: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(FieldExpression fe, JsonGenerator gen, SerializerProvider serializers) throws IOException {
	gen.writeStartObject();
    gen.writeStringField("sql", fe.getSql());
    gen.writeArrayFieldStart("tables");
    
    fe.getTables().stream().forEach(t -> { 
    		String n = t.getDatasource().getName() + ".";
    		if(!CommonUtils.isBlank(t.getSchemaName())) n = n + t.getSchemaName() + ".";
    		
    		n = n + t.getName();
    		
   			try {
			gen.writeString(n);
		} catch (IOException e) {
			new RuntimeException("Could not write out expression tables for " + fe.getSql() + ". \n" + e.getMessage());
		}
    });
    
    gen.writeEndArray();
    gen.writeEndObject();		
}
 
開發者ID:ajoabraham,項目名稱:hue,代碼行數:23,代碼來源:FieldExpSerDe.java

示例4: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(NonPrivateFieldsAndAccessorsFieldDetectionPolicyModel object, JsonGenerator jsonGenerator, boolean writeStartAndEnd) throws IOException {
    if (writeStartAndEnd) {
        jsonGenerator.writeStartObject();
    }
    if (object.annotatedString != null) {
        jsonGenerator.writeStringField("annotated_string", object.annotatedString);
    }
    jsonGenerator.writeNumberField("intToIgnoreForParse", object.intToIgnoreForParse);
    final List<String> lslocalnonAnnotatedList = object.nonAnnotatedList;
    if (lslocalnonAnnotatedList != null) {
        jsonGenerator.writeFieldName("nonAnnotatedList");
        jsonGenerator.writeStartArray();
        for (String element1 : lslocalnonAnnotatedList) {
            if (element1 != null) {
                jsonGenerator.writeString(element1);
            }
        }
        jsonGenerator.writeEndArray();
    }
    jsonGenerator.writeNumberField("nonAnnotatedPrivateInt", object.getNonAnnotatedPrivateInt());
    if (object.nonAnnotatedString != null) {
        jsonGenerator.writeStringField("nonAnnotatedString", object.nonAnnotatedString);
    }
    jsonGenerator.writeNumberField("privateStaticIntToInclude", object.getPrivateStaticIntToInclude());
    jsonGenerator.writeNumberField("privateTransientIntToInclude", object.getPrivateTransientIntToInclude());
    jsonGenerator.writeNumberField("staticIntToInclude", object.staticIntToInclude);
    jsonGenerator.writeNumberField("transientIntToInclude", object.transientIntToInclude);
    if (writeStartAndEnd) {
        jsonGenerator.writeEndObject();
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:NonPrivateFieldsAndAccessorsFieldDetectionPolicyModel$$JsonObjectMapper.java

示例5: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(IfFunction value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    gen.writeStartObject();
    gen.writeArrayFieldStart("Fn::If");
    serializers.defaultSerializeValue(value.getConditionName(), gen);
    serializers.defaultSerializeValue(value.getThenValue(), gen);
    serializers.defaultSerializeValue(value.getElseValue(), gen);
    gen.writeEndArray();
    gen.writeEndObject();
}
 
開發者ID:salesforce,項目名稱:cf2pojo,代碼行數:12,代碼來源:IfFunction.java

示例6: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Condition condition, JsonGenerator generator,
                      SerializerProvider provider)
        throws IOException, JsonProcessingException {
    generator.writeStartArray();
    generator.writeString(condition.getColumn());
    generator.writeString(condition.getFunction().function());
    generator.writeObject(condition.getValue());
    generator.writeEndArray();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:11,代碼來源:ConditionSerializer.java

示例7: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
/**
 * Serialize a list of objects to a JsonGenerator.
 *
 * @param list The list of objects to serialize.
 * @param jsonGenerator The JsonGenerator to which the list should be serialized
 */
public void serialize(List<T> list, JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartArray();
    for (T object : list) {
        if (object != null) {
            serialize(object, jsonGenerator, true);
        } else {
            jsonGenerator.writeNull();
        }
    }
    jsonGenerator.writeEndArray();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:JsonMapper.java

示例8: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Authorization value, JsonGenerator jgen, SerializerProvider provider)
		throws IOException {

	jgen.writeStartArray();
	jgen.writeString(value.uri);
	jgen.writeNumber(value.methods);
	jgen.writeEndArray();
}
 
開發者ID:beduino-project,項目名稱:dcaf-java,代碼行數:10,代碼來源:Authorization.java

示例9: getJsonFromPrimitiveIntArray

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
public static void getJsonFromPrimitiveIntArray(JsonGenerator jg, int[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (int obj : array) {
    jg.writeNumber(obj);
  }
  jg.writeEndArray();
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:9,代碼來源:JsonHelper.java

示例10: serializePortReply

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
public static void serializePortReply(List<OFPortStatsReply> portReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	OFPortStatsReply portReply = portReplies.get(0); // we will get only one PortReply and it will contains many OFPortStatsEntry ?
	jGen.writeStringField("version", portReply.getVersion().toString()); //return the enum name
	jGen.writeFieldName("port");
	jGen.writeStartArray();
	for(OFPortStatsEntry entry : portReply.getEntries()) {
		jGen.writeStartObject();
		jGen.writeStringField("portNumber",entry.getPortNo().toString());
		jGen.writeNumberField("receivePackets", entry.getRxPackets().getValue());
		jGen.writeNumberField("transmitPackets", entry.getTxPackets().getValue());
		jGen.writeNumberField("receiveBytes", entry.getRxBytes().getValue());
		jGen.writeNumberField("transmitBytes", entry.getTxBytes().getValue());
		jGen.writeNumberField("receiveDropped", entry.getRxDropped().getValue());
		jGen.writeNumberField("transmitDropped", entry.getTxDropped().getValue());
		jGen.writeNumberField("receiveErrors", entry.getRxErrors().getValue());
		jGen.writeNumberField("transmitErrors", entry.getTxErrors().getValue());
		jGen.writeNumberField("receiveFrameErrors", entry.getRxFrameErr().getValue());
		jGen.writeNumberField("receiveOverrunErrors", entry.getRxOverErr().getValue());
		jGen.writeNumberField("receiveCRCErrors", entry.getRxCrcErr().getValue());
		jGen.writeNumberField("collisions", entry.getCollisions().getValue());
		if (OFVersion.OF_13 == entry.getVersion()) {
			jGen.writeNumberField("durationSec", entry.getDurationSec());
			jGen.writeNumberField("durationNsec", entry.getDurationNsec());
		}
		jGen.writeEndObject();
	}
	jGen.writeEndArray();
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:29,代碼來源:StatsReplySerializer.java

示例11: writeJson

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
/**
 * Serialize a chunk list to json
 *
 * @param generator a json generator (jackson)
 * @param chunks    the chunk list
 */
static void writeJson(JsonGenerator generator, List<? extends ArrayChunk> chunks) {
    Objects.requireNonNull(generator);
    try {
        generator.writeStartArray();
        for (ArrayChunk chunk : chunks) {
            chunk.writeJson(generator);
        }
        generator.writeEndArray();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:19,代碼來源:ArrayChunk.java

示例12: getJsonFromBigIntArray

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
public static void getJsonFromBigIntArray(JsonGenerator jg, BigInteger[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (BigInteger obj : array) {
    jg.writeNumber(obj);
  }
  jg.writeEndArray();
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:9,代碼來源:JsonHelper.java

示例13: processStructEnd

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private void processStructEnd(JsonToken token, JsonGenerator jgen)
    throws IOException {
  if (token.id() == JsonTokenId.ID_END_OBJECT) {
    jgen.writeEndObject();
  } else if (token.id() == JsonTokenId.ID_END_ARRAY) {
    jgen.writeEndArray();
  } else {
    LOGGER.error("Illegal struct end {}", token.id());
    throw new RuntimeException("Illegal struct end " + token.id());
  }
}
 
開發者ID:cerner,項目名稱:beadledom,代碼行數:12,代碼來源:FieldFilter.java

示例14: printRepeatedEnum

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
static void printRepeatedEnum(List<Integer> values, JsonGenerator gen, EnumDescriptor descriptor)
    throws IOException {
  int numElements = values.size();
  gen.writeStartArray(numElements);
  for (int i = 0; i < numElements; i++) {
    printEnum(values.get(i), gen, descriptor);
  }
  gen.writeEndArray();
}
 
開發者ID:curioswitch,項目名稱:curiostack,代碼行數:10,代碼來源:SerializeSupport.java

示例15: writeObject

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public boolean writeObject(Object obj, JsonGenerator jgen, boolean expand) throws JsonProcessingException, IOException {
  logger.debug("collection");
  // convert this 'on the fly' to an array of objects
  Collection<?> c = (Collection<?>) obj;
  jgen.writeStartArray();
  for(Object o : c) {
    if (!parent.writeObject(o, jgen, false))
      jgen.writeObject(o.toString());
  }
  jgen.writeEndArray();
  return true;
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:14,代碼來源:BasicObjectSerializer.java


注:本文中的com.fasterxml.jackson.core.JsonGenerator.writeEndArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。