当前位置: 首页>>代码示例>>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;未经允许,请勿转载。