当前位置: 首页>>代码示例>>Java>>正文


Java JsonGenerator.writeNumber方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeNumber方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeNumber方法的具体用法?Java JsonGenerator.writeNumber怎么用?Java JsonGenerator.writeNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.core.JsonGenerator的用法示例。


在下文中一共展示了JsonGenerator.writeNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

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

示例3: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeNumber(this.requestId);
	generator.writeNumber(this.registrationId);
	generator.writeStartObject();
	if (this.caller != null) {
		generator.writeNumberField("caller", this.caller.longValue());
	}
	generator.writeEndObject();

	if (this.argumentsKw != null) {
		if (this.arguments == null) {
			generator.writeStartArray();
			generator.writeEndArray();
		}
		else {
			generator.writeObject(this.arguments);
		}
		generator.writeObject(this.argumentsKw);
	}
	else if (this.arguments != null) {
		generator.writeObject(this.arguments);
	}
}
 
开发者ID:ralscha,项目名称:wamp2spring,代码行数:26,代码来源:InvocationMessage.java

示例4: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(ValueProvider<?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
	if (StringValueProvider.class.isAssignableFrom(value.getClass())) {
		jgen.writeString((String) value.getValue());
	} else if (IntValueProvider.class.isAssignableFrom(value.getClass())) {
		jgen.writeNumber((Integer) value.getValue());
	} else {
		throw new IllegalArgumentException(
				String.format("Unsupported value enum type: %s", value.getClass().getName()));
	}
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:12,代码来源:ValueEnumSerializer.java

示例5: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Short s, JsonGenerator jGen,
                      SerializerProvider serializer) throws IOException,
                                              JsonProcessingException {
    if (s == null) jGen.writeNull();
    else jGen.writeNumber(s.shortValue() & 0xffff);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:8,代码来源:UShortSerializer.java

示例6: getJsonFromWrapperLongArray

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public static void getJsonFromWrapperLongArray(JsonGenerator jg, Long[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (Long obj : array) {
    jg.writeNumber(obj.longValue());
  }
  jg.writeEndArray();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:JsonHelper.java

示例7: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(T object, String fieldName, boolean writeFieldNameForObject, JsonGenerator jsonGenerator) throws IOException {
    if (fieldName != null) {
        jsonGenerator.writeNumberField(fieldName, convertToFloat(object));
    } else {
        jsonGenerator.writeNumber(convertToFloat(object));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:FloatBasedTypeConverter.java

示例8: getJsonFromWrapperFloatArray

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public static void getJsonFromWrapperFloatArray(JsonGenerator jg, Float[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (Float obj : array) {
    jg.writeNumber(obj.floatValue());
  }
  jg.writeEndArray();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:JsonHelper.java

示例9: getJsonFromWrapperIntArray

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public static void getJsonFromWrapperIntArray(JsonGenerator jg, Integer[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (Integer obj : array) {
    jg.writeNumber(obj.intValue());
  }
  jg.writeEndArray();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:JsonHelper.java

示例10: getJsonFromPrimitiveLongArray

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public static void getJsonFromPrimitiveLongArray(JsonGenerator jg, long[] array, String pf)
    throws JsonGenerationException, IOException {
  jg.writeStartArray();
  for (long obj : array) {
    jg.writeNumber(obj);
  }
  jg.writeEndArray();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:JsonHelper.java

示例11: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeStartObject();
	if (this.message != null) {
		generator.writeStringField("message", this.message);
	}
	generator.writeEndObject();

	generator.writeString(this.reason);
}
 
开发者ID:ralscha,项目名称:wamp2spring,代码行数:12,代码来源:AbortMessage.java

示例12: serialize

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

	generator.writeStartObject();
	if (this.discloseCaller) {
		generator.writeBooleanField("disclose_caller", this.discloseCaller);
	}
	generator.writeEndObject();

	generator.writeString(this.procedure);

}
 
开发者ID:ralscha,项目名称:wamp2spring,代码行数:15,代码来源:RegisterMessage.java

示例13: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(OFPort port, JsonGenerator jGen,
                      SerializerProvider serializer)
                              throws IOException, JsonProcessingException {
    jGen.writeNumber(port.getPortNumber());
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:7,代码来源:OFPortSerializer.java

示例14: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider)
		throws IOException, JsonProcessingException {
	jgen.writeNumber(value.getTime());
}
 
开发者ID:anilallewar,项目名称:microservices-basics-spring-boot,代码行数:6,代码来源:CommentDTO.java

示例15: serialize

import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(final JobDataFragmentWrapper data, JsonGenerator generator, SerializerProvider provider)
    throws IOException {
  try (TimedBlock b = time("serialize job results VV -> JSON")) {
    /**
     * Example output:
     *
     * {
     *    "returnedRowCount" : 5,
     *    "columns": [
     *        {
     *          "name": "colBit",
     *          "type": "BOOLEAN",
     *          "index": 0,
     *          "status": null
     *        },
     *        {
     *          "name": "colTinyInt",
     *          "type": "INTEGER",
     *          "index": 1,
     *          "status": null
     *        }
     *    ],
     *    "rows" : [
     *       ... one object for each row written by {@link DACJobResultsSerializer} ...
     *       ... See {@link DACJobResultsSerializer} for details of format ...
     *    ]
     * }
     *
     */

    //final RecordBatches recordBatches = data.recordBatches;

    generator.writeStartObject();
    generator.writeFieldName("returnedRowCount");
    generator.writeNumber(data.getReturnedRowCount());
    generator.writeFieldName("columns");
    generator.writeStartArray();
    for (Column c : data.getColumns()) {
      generator.writeObject(c);
    }
    generator.writeEndArray();

    generator.writeFieldName("rows");
    generator.writeStartArray();


    SerializationContextImpl context = new SerializationContextImpl(data.getJobId().getId());

    DACJobResultsSerializer jsonWriter =
        new DACJobResultsSerializer(generator, context, Integer.getInteger(MAX_CELL_SIZE_KEY, 100));
    jsonWriter.setup();

    int currentRowInWriting = data.offsetInJobResults; // row number in complete job results
    for(RecordBatchHolder batchHolder : data.delegate.getRecordBatches()) {
      final EventBasedRecordWriter recordWriter =
          new EventBasedRecordWriter(batchHolder.getData().getContainer(), jsonWriter);

      for (int i = batchHolder.getStart(); i < batchHolder.getEnd(); i++) {
        context.setRowNum(currentRowInWriting++);
        recordWriter.writeOneRecord(i);
      }
    }

    generator.writeEndArray();
    generator.writeEndObject();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:69,代码来源:JobDataFragmentWrapper.java


注:本文中的com.fasterxml.jackson.core.JsonGenerator.writeNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。