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


Java JsonGenerator.writeArrayFieldStart方法代碼示例

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


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

示例1: serialize

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

        gen.writeStartObject();

        gen.writeStringField("type", value.getPropertyType().getSimpleName());
        gen.writeBooleanField("indexed", value.isIndexedProperty());

        gen.writeArrayFieldStart("methods");
        if(value.canRead()) { gen.writeString("read"); }
        if(value.canWrite()) { gen.writeString("write"); }
        if(value.canAdd()) { gen.writeString("add"); }
        if(value.canRemove()) { gen.writeString("remove"); }
        if(value.canCount()) { gen.writeString("count"); }
        gen.writeEndArray();
//        if(value.canRead()) { gen.writeNumberField("value");

        gen.writeEndObject();

    }
 
開發者ID:etomica,項目名稱:etomica,代碼行數:21,代碼來源:PropertySerializer.java

示例2: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
  public void serialize(VirtualNetwork vNet, JsonGenerator jGen,
          SerializerProvider serializer) throws IOException,
          JsonProcessingException {
      jGen.writeStartObject();
      
      jGen.writeStringField("name", vNet.name);
      jGen.writeStringField("guid", vNet.guid);
      jGen.writeStringField("gateway", vNet.gateway);

      jGen.writeArrayFieldStart("portMac");
Iterator<Entry<String, MacAddress>> entries = vNet.portToMac.entrySet().iterator();
while (entries.hasNext()){
	jGen.writeStartObject();
	Entry<String, MacAddress> entry = entries.next();
	jGen.writeStringField("port",entry.getKey().toString());
	jGen.writeStringField("mac",entry.getValue().toString());
	jGen.writeEndObject();
}
      jGen.writeEndArray();
      
      jGen.writeEndObject();
  }
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:24,代碼來源:VirtualNetworkSerializer.java

示例3: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JoinFunction value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    gen.writeStartObject();
    gen.writeArrayFieldStart("Fn::Join");
    gen.writeString(value.getSeparator());

    if (value.isExplicitArray()) {
        gen.writeStartArray();
    }

    for (ValueType valueType : value.getStrings()) {
        serializers.defaultSerializeValue(valueType, gen);
    }

    if (value.isExplicitArray()) {
        gen.writeEndArray();
    }
    gen.writeEndArray();
    gen.writeEndObject();
}
 
開發者ID:salesforce,項目名稱:cf2pojo,代碼行數:22,代碼來源:JoinFunction.java

示例4: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(SelectFunction value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    gen.writeStartObject();
    gen.writeArrayFieldStart("Fn::Select");
    gen.writeString(value.getIndex());

    if (value.isExplicitArray()) {
        gen.writeStartArray();
    }

    for (ValueType valueType : value.getStrings()) {
        serializers.defaultSerializeValue(valueType, gen);
    }

    if (value.isExplicitArray()) {
        gen.writeEndArray();
    }
    gen.writeEndArray();
    gen.writeEndObject();
}
 
開發者ID:salesforce,項目名稱:cf2pojo,代碼行數:22,代碼來源:SelectFunction.java

示例5: writeAdministratieveHandelingen

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private void writeAdministratieveHandelingen(final List<BlobViewObject> administratieveHandelingen, final JsonGenerator jgen) throws IOException {
    if (administratieveHandelingen != null && !administratieveHandelingen.isEmpty()) {
        jgen.writeObjectFieldStart(Element.ADMINISTRATIEVEHANDELING.getElementNaam());
        jgen.writeStringField(VELD_TYPE, "tabelGroep");
        jgen.writeArrayFieldStart("kolomtitels");
        jgen.writeString("Technisch ID");
        jgen.writeString(Element.ADMINISTRATIEVEHANDELING_SOORTNAAM.getElementNaam());
        jgen.writeString(Element.ADMINISTRATIEVEHANDELING_PARTIJCODE.getElementNaam());
        jgen.writeString(Element.ADMINISTRATIEVEHANDELING_TIJDSTIPREGISTRATIE.getElementNaam());
        jgen.writeString("Mutaties");
        jgen.writeString("$css");
        jgen.writeEndArray();
        jgen.writeArrayFieldStart("data");
        for (final BlobViewObject administratieveHandeling : administratieveHandelingen) {
            writeAdministratieveHandeling(administratieveHandeling, jgen);
        }
        jgen.writeEndArray();
        jgen.writeEndObject();
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:21,代碼來源:PersoonDetailSerializer.java

示例6: writeHistorieRecordKop

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private void writeHistorieRecordKop(final JsonGenerator jgen, final BlobViewGroep groep) throws IOException {
    jgen.writeArrayFieldStart("kolomtitels");
    jgen.writeString(INDEX_OBJECT);
    if (isFormeel(groep.getElement())) {
        jgen.writeString(TIJDSTIP_REGISTRATIE);
        jgen.writeString(TIJDSTIP_VERVAL);
        jgen.writeString(NADERE_AANDUIDING_VERVAL);
        jgen.writeString(ActieType.INHOUD.getOmschrijving());
        jgen.writeString(ActieType.VERVAL.getOmschrijving());
        jgen.writeString(CSS);

    } else if (isMaterieel(groep.getElement())) {
        jgen.writeString(DATUM_INGANG_GELDIGHEID);
        jgen.writeString(DATUM_EINDE_GELDIGHEID);
        jgen.writeString(TIJDSTIP_REGISTRATIE);
        jgen.writeString(TIJDSTIP_VERVAL);
        jgen.writeString(NADERE_AANDUIDING_VERVAL);
        jgen.writeString(ActieType.INHOUD.getOmschrijving());
        jgen.writeString(ActieType.AANPASSING.getOmschrijving());
        jgen.writeString(ActieType.VERVAL.getOmschrijving());
        jgen.writeString(CSS);
    }
    jgen.writeString(DETAIL);
    jgen.writeEndArray();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:26,代碼來源:ObjectSerializer.java

示例7: buildJSONFromFields

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private String buildJSONFromFields(Collection<SearchHitField> values) {
	JsonFactory nodeFactory = new JsonFactory();
	try {
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		JsonGenerator generator = nodeFactory.createGenerator(stream, JsonEncoding.UTF8);
		generator.writeStartObject();
		for (SearchHitField value : values) {
			if (value.getValues().size() > 1) {
				generator.writeArrayFieldStart(value.getName());
				for (Object val : value.getValues()) {
					generator.writeObject(val);
				}
				generator.writeEndArray();
			} else {
				generator.writeObjectField(value.getName(), value.getValue());
			}
		}
		generator.writeEndObject();
		generator.flush();
		return new String(stream.toByteArray(), Charset.forName("UTF-8"));
	} catch (IOException e) {
		return null;
	}
}
 
開發者ID:uckefu,項目名稱:uckefu,代碼行數:25,代碼來源:UKResultMapper.java

示例8: 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

示例9: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
/**
  * Performs the serialization of a OneComponentTime object
  */
@Override
public void serialize(CumulativeTimeBucket ctb,
                JsonGenerator jGen,
                SerializerProvider serializer) 
                throws IOException, JsonProcessingException {
    jGen.writeStartObject();
    Timestamp ts = new Timestamp(ctb.getStartTimeNs()/1000000);
    jGen.writeStringField("start-time", ts.toString());
    jGen.writeStringField("current-time", 
      new Timestamp(System.currentTimeMillis()).toString());
    jGen.writeNumberField("total-packets", ctb.getTotalPktCnt());
    jGen.writeNumberField("average", ctb.getAverageProcTimeNs());
    jGen.writeNumberField("min", ctb.getMinTotalProcTimeNs());
    jGen.writeNumberField("max", ctb.getMaxTotalProcTimeNs());
    jGen.writeNumberField("std-dev", ctb.getTotalSigmaProcTimeNs());
    jGen.writeArrayFieldStart("modules");
    for (OneComponentTime oct : ctb.getModules()) {
        serializer.defaultSerializeValue(oct, jGen);
    }
    jGen.writeEndArray();
    jGen.writeEndObject();
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:26,代碼來源:CumulativeTimeBucketJSONSerializer.java

示例10: serialize

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

    generator.writeArrayFieldStart("certificates");
    Arrays.stream(value.getCertificates()).forEach(Unchecked.consumer(c -> generator.writeBinary(c.getEncoded())));
    generator.writeEndArray();
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:10,代碼來源:X509CertificateCredentialJsonSerializer.java

示例11: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
    public void serialize(Index index, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
//        jsonGenerator.writeStartObject();
        jsonGenerator.writeObjectFieldStart("index");
        jsonGenerator.writeNumberField("number", index.getIndex());
        jsonGenerator.writeArrayFieldStart("numbers");
        int[] numbers = index.getNumbers().stream().mapToInt(i -> i).toArray();
        jsonGenerator.writeArray(numbers, 0, numbers.length);
        jsonGenerator.writeEndArray();
        jsonGenerator.writeEndObject();
//        jsonGenerator.writeEndObject();
    }
 
開發者ID:thelittlehawk,項目名稱:CSIS280,代碼行數:13,代碼來源:IndexSerializer.java

示例12: serialize

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

示例13: serialize

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

  synchronized (value) {
    jgen.writeStartObject();

    jgen.writeObjectField("type", value.getClass().getSimpleName());

    serialize(value, jgen);

    jgen.writeArrayFieldStart("labels");
    if (value.getLabels() != null) {
      for (String label : value.getLabels())
        jgen.writeObject(label);
    }
    jgen.writeEndArray();

    jgen.writeArrayFieldStart("items");
    if (value.getItems() != null) {
      for (Object obj : value.getItems())
        if (!getObjectSerializer().writeObject(obj, jgen, true))
          jgen.writeObject(obj.toString());
    }
    jgen.writeEndArray();

    jgen.writeObjectField("layout", value.getLayoutManager());

    jgen.writeEndObject();
  }
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:34,代碼來源:BasicOutputContainerSerializer.java

示例14: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
public void serialize(JsonGenerator jgen, BeakerObjectConverter boc) throws JsonGenerationException, IOException {
  jgen.writeStartObject();
  if (theStyle!=null) jgen.writeStringField("thestyle", theStyle);
  if (theClass!=null) jgen.writeStringField("theclass", theClass);
  jgen.writeArrayFieldStart("cols");
  for (dashColumn r : payload)
    r.serialize(jgen, boc);
  jgen.writeEndArray();
  jgen.writeEndObject();
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:11,代碼來源:BeakerDashboard.java

示例15: writeObjecten

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
/**
 * Schrijf objecten.
 * @param element element
 * @param objecten objecten
 * @param jgen json generator
 * @throws IOException bij fouten
 */
public void writeObjecten(final Element element, final Collection<BlobViewObject> objecten, final JsonGenerator jgen) throws IOException {
    if (objecten != null && !objecten.isEmpty()) {
        jgen.writeObjectFieldStart(element.getElementNaam());
        JsonUtils.writeAsString(jgen, TYPE, GROEP);
        jgen.writeArrayFieldStart(element.getElementNaam());
        for (final BlobViewObject object : objecten) {
            jgen.writeStartObject();
            writeObject(object, jgen);
            jgen.writeEndObject();
        }
        jgen.writeEndArray();
        jgen.writeEndObject();
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:22,代碼來源:ObjectSerializer.java


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