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


Java JsonGenerator.writeEndObject方法代碼示例

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


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

示例1: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeString(this.realm);
	generator.writeStartObject();
	generator.writeObjectFieldStart("roles");
	for (WampRole wampRole : this.roles) {
		generator.writeObjectFieldStart(wampRole.getRole());
		if (wampRole.hasFeatures()) {
			generator.writeObjectFieldStart("features");
			for (String feature : wampRole.getFeatures()) {
				generator.writeBooleanField(feature, true);
			}
			generator.writeEndObject();
		}
		generator.writeEndObject();
	}
	generator.writeEndObject();
	generator.writeEndObject();
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:21,代碼來源:HelloMessage.java

示例2: serialize

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

    jsonGenerator.writeStringField("subjectId", limitViolation.getSubjectId());
    jsonGenerator.writeStringField("limitType", limitViolation.getLimitType().name());
    JsonUtil.writeOptionalStringField(jsonGenerator, "limitName", limitViolation.getLimitName());
    JsonUtil.writeOptionalIntegerField(jsonGenerator, "acceptableDuration", limitViolation.getAcceptableDuration());
    jsonGenerator.writeNumberField("limit", limitViolation.getLimit());
    jsonGenerator.writeNumberField("limitReduction", limitViolation.getLimitReduction());
    jsonGenerator.writeNumberField("value", limitViolation.getValue());
    JsonUtil.writeOptionalEnumField(jsonGenerator, "side", limitViolation.getSide());

    JsonUtil.writeExtensions(limitViolation, jsonGenerator, serializerProvider);

    jsonGenerator.writeEndObject();
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:18,代碼來源:LimitViolationSerializer.java

示例3: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Metric metric, JsonGenerator json, SerializerProvider serializerProvider)
		throws IOException {
	json.writeStartObject();
	InternalFormatters formatters = formattersQueue.poll();
	if (formatters == null) {
		formatters = new InternalFormatters();
	}
	json.writeStringField("name", metric.getName());
	try {
		json.writeNumberField("value", formatters.getDecimalFormat()
				.parse(formatters.getDecimalFormat().format(metric.getValue().doubleValue())).doubleValue());
	}
	catch (ParseException e) {
		e.printStackTrace();
	}
	json.writeStringField("timestamp", formatters.getDateFormat().format(metric.getTimestamp()));
	json.writeEndObject();
	formattersQueue.offer(formatters);
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dataflow-metrics-collector,代碼行數:21,代碼來源:MetricJsonSerializer.java

示例4: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeNumber(this.sessionId);

	generator.writeStartObject();

	generator.writeObjectFieldStart("roles");
	for (WampRole wampRole : this.roles) {
		generator.writeObjectFieldStart(wampRole.getRole());
		if (wampRole.hasFeatures()) {
			generator.writeObjectFieldStart("features");
			for (String feature : wampRole.getFeatures()) {
				generator.writeBooleanField(feature, true);
			}
			generator.writeEndObject();
		}
		generator.writeEndObject();
	}
	generator.writeEndObject();

	if (this.realm != null) {
		generator.writeStringField("realm", this.realm);
	}
	generator.writeEndObject();
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:27,代碼來源:WelcomeMessage.java

示例5: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeNumber(this.requestId);

	if (this.subscriptionId != null || this.reason != null) {
		generator.writeStartObject();
		if (this.reason != null) {
			generator.writeStringField("reason", this.reason);
		}
		if (this.subscriptionId != null) {
			generator.writeNumberField("subscription", this.subscriptionId);
		}
		generator.writeEndObject();
	}
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:17,代碼來源:UnsubscribedMessage.java

示例6: serializeGroupDescReply

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
/***
 * Serializes Group Desc Reply
 * @author Naveen
 * @param groupDescReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeGroupDescReply(List<OFGroupDescStatsReply> groupDescReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	OFGroupDescStatsReply groupDescReply = groupDescReplies.get(0);
	jGen.writeStringField("version", groupDescReply.getVersion().toString()); //return the enum name
	jGen.writeFieldName("groupDesc");
	jGen.writeStartArray();
	for(OFGroupDescStatsEntry entry : groupDescReply.getEntries()) {
		jGen.writeStartObject();                        
		jGen.writeStringField("groupType",entry.getGroupType().toString());
		jGen.writeStringField("groupNumber",entry.getGroup().toString());                                               
		jGen.writeFieldName("buckets");            
		jGen.writeStartArray();            
		for(OFBucket buckets : entry.getBuckets()) {            	
			jGen.writeStartObject();
			jGen.writeNumberField("weight", buckets.getWeight());
			jGen.writeNumberField("watchPortNumber", buckets.getWatchPort().getPortNumber());
			jGen.writeStringField("watchGroup", buckets.getWatchGroup().toString());            	
			OFActionListSerializer.serializeActions(jGen, buckets.getActions());            	
			jGen.writeEndObject();
		}//End of for loop - buckets
		jGen.writeEndArray();//end of buckets            
		jGen.writeEndObject();//end of group Desc iteration
	}//End of for loop - GroupDescStats
	jGen.writeEndArray();//end of group Desc
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:33,代碼來源:StatsReplySerializer.java

示例7: serialize

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

	gen.writeStartObject();

	BeanInformation info = BeanInformation.get(value.getClass());

	for (String attrName : info.getAttributeNames()) {
		BeanAttributeInformation attribute = info.getAttribute(attrName);
		Object linkValue = attribute.getValue(value);
		if (linkValue != null) {
			gen.writeObjectFieldStart(attrName);
			if (linkValue instanceof String) {
				gen.writeStringField(SerializerUtil.HREF, linkValue.toString());
			}
			else {
				gen.writeObject(linkValue);
			}
			gen.writeEndObject();
		}
	}

	gen.writeEndObject();

}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:27,代碼來源:LinksInformationSerializer.java

示例8: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public final void serialize(final DienstbundelLo3RubriekView value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
    jgen.writeStartObject();
    JsonUtils.writeAsInteger(jgen, DienstbundelLo3RubriekModule.ID, value.getId());

    JsonUtils.writeAsString(
        jgen,
        DienstbundelLo3RubriekModule.ACTIEF,
        value.isActief(),
        DienstbundelLo3RubriekModule.WAARDE_JA,
        DienstbundelLo3RubriekModule.WAARDE_NEE);

    JsonUtils.writeAsInteger(jgen, DienstbundelLo3RubriekModule.DIENSTBUNDEL, value.getDienstbundel().getId());

    JsonUtils.writeAsInteger(jgen, DienstbundelLo3RubriekModule.RUBRIEK, value.getLo3Rubriek().getId());
    JsonUtils.writeAsString(jgen, DienstbundelLo3RubriekModule.RUBRIEK_NAAM, value.getLo3Rubriek().getNaam());

    jgen.writeEndObject();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:20,代碼來源:DienstbundelLo3RubriekSerializer.java

示例9: serialize

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

  jgen.writeStartObject();

  super.serialize(points, jgen, sp);

  if (points.getSizes() != null) {
    jgen.writeObjectField("sizes", points.getSizes());
  } else {
    jgen.writeObjectField("size", points.getSize());
  }
  if (points.getShapes() != null) {
    jgen.writeObjectField("shaps", points.getShapes());
  } else {
    jgen.writeObjectField("shape", points.getShape());
  }
  if (points.getFills() != null) {
    jgen.writeObjectField("fills", points.getFills());
  } else {
    jgen.writeObjectField("fill", points.getFill());
  }
  if (points.getColors() != null) {
    jgen.writeObjectField("colors", points.getColors());
  } else {
    jgen.writeObjectField("color", points.getColor());
  }
  if (points.getOutlineColors() != null) {
    jgen.writeObjectField("outline_colors", points.getOutlineColors());
  } else {
    jgen.writeObjectField("outline_color", points.getOutlineColor());
  }
  jgen.writeEndObject();
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:36,代碼來源:PointsSerializer.java

示例10: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(
    Frame frame, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
    throws IOException {
  jsonGenerator.writeStartObject(frame);
  jsonGenerator.writeObjectField("protocol_version", frame.protocolVersion);
  jsonGenerator.writeObjectField("beta", frame.beta);
  jsonGenerator.writeObjectField("stream_id", frame.streamId);
  jsonGenerator.writeObjectField("tracing_id", frame.tracing ? frame.tracingId.toString() : null);
  jsonGenerator.writeObjectField("custom_payload", frame.customPayload);
  jsonGenerator.writeObjectField("warnings", frame.warnings);
  jsonGenerator.writeObjectField("message", frame.message);
  jsonGenerator.writeEndObject();
}
 
開發者ID:datastax,項目名稱:simulacron,代碼行數:15,代碼來源:FrameSerializer.java

示例11: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(CompilationUnit cu, JsonGenerator jG, SerializerProvider provider) throws IOException {
    jG.writeStartObject();
    jG.writeFieldName("CompilationUnit");

    serializeAll(cu, cu, jG, provider);

    jG.writeEndObject();
}
 
開發者ID:bblfsh,項目名稱:java-driver,代碼行數:10,代碼來源:CompilationUnitSerializer.java

示例12: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Zone value, JsonGenerator jgen, SerializerProvider provider)
    throws IOException {
  jgen.writeStartObject();
  for (Map.Entry<String, Object> entry : value.entrySet()) {
    jgen.writeFieldName(entry.getKey());
    jgen.writeString(entry.getValue().toString().toUpperCase());
  }
  jgen.writeEndObject();
}
 
開發者ID:wenwu315,項目名稱:XXXX,代碼行數:11,代碼來源:JacksonCodecTest.java

示例13: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(SimpleGenericModel<T> object, JsonGenerator jsonGenerator, boolean writeStartAndEnd) throws IOException {
  if (writeStartAndEnd) {
    jsonGenerator.writeStartObject();
  }
  if (object.date != null) {
    getjava_util_Date_type_converter().serialize(object.date, "date", true, jsonGenerator);
  }
  if (object.string != null) {
    jsonGenerator.writeStringField("string", object.string);
  }
  jsonGenerator.writeNumberField("test_double", object.testDouble);
  if (object.testDoubleObj != null) {
    jsonGenerator.writeNumberField("test_double_obj", object.testDoubleObj);
  }
  jsonGenerator.writeNumberField("test_float", object.testFloat);
  if (object.testFloatObj != null) {
    jsonGenerator.writeNumberField("test_float_obj", object.testFloatObj);
  }
  jsonGenerator.writeNumberField("test_int", object.testInt);
  if (object.testIntObj != null) {
    jsonGenerator.writeNumberField("test_int_obj", object.testIntObj);
  }
  jsonGenerator.writeNumberField("test_long", object.testLong);
  if (object.testLongObj != null) {
    jsonGenerator.writeNumberField("test_long_obj", object.testLongObj);
  }
  if (object.testString != null) {
    jsonGenerator.writeStringField("test_string", object.testString);
  }
  if (object.testT != null) {
    jsonGenerator.writeFieldName("test_t");
    m84ClassJsonMapper.serialize(object.testT, jsonGenerator, true);
  }
  if (writeStartAndEnd) {
    jsonGenerator.writeEndObject();
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:39,代碼來源:SimpleGenericModel$$JsonObjectMapper.java

示例14: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(ExtraValues extension, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeNumberField("extraValue1", extension.getExtraValue1());
    jsonGenerator.writeNumberField("extraValue2", extension.getExtraValue2());
    jsonGenerator.writeEndObject();
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:8,代碼來源:ExtraValuesJson.java

示例15: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Join join, JsonGenerator gen, SerializerProvider serializers) throws IOException {
	gen.writeStartObject();
    
	gen.writeStringField("sql", join.getSql());
    gen.writeStringField("leftTable", tableName(join.getLeft()));
    gen.writeStringField("rightTable", tableName(join.getRight()));
    gen.writeNumberField("cost", join.getCost());
    gen.writeNumberField("allowRollDown", join.getCost());
    gen.writeStringField("cardinalityType", join.getCardinalityType().toString());
    gen.writeStringField("joinType", join.getJoinType().toString());
	
    gen.writeEndObject();		
}
 
開發者ID:ajoabraham,項目名稱:hue,代碼行數:15,代碼來源:JoinSerDe.java


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