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