本文整理汇总了Java中com.fasterxml.jackson.databind.ser.DefaultSerializerProvider类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSerializerProvider类的具体用法?Java DefaultSerializerProvider怎么用?Java DefaultSerializerProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSerializerProvider类属于com.fasterxml.jackson.databind.ser包,在下文中一共展示了DefaultSerializerProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeBigIntXWithNanoPlotType_resultJsonHasStringXs
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeBigIntXWithNanoPlotType_resultJsonHasStringXs() throws IOException {
//when
ConstantBand constantBand = new ConstantBand();
constantBand.setX(
Arrays.asList(
new BigInteger("12345678901234567891000"), new BigInteger("12345678901234567892000")));
constantBand.setPlotType(NanoPlot.class);
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("x");
Assertions.assertThat(arrayNode.get(0).isTextual()).isTrue();
}
示例2: serializeDataOfHeatMap_resultJsonHasGraphicsList
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeDataOfHeatMap_resultJsonHasGraphicsList() throws IOException {
//when
HeatMap heatMap = new HeatMap();
heatMap.setData(
new Integer[][] {
new Integer[] {new Integer(1), new Integer(2)},
new Integer[] {new Integer(3), new Integer(4)}
});
heatMapSerializer.serialize(heatMap, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("graphics_list")).isTrue();
Assertions.assertThat(actualObj.get("graphics_list")).isNotEmpty();
}
示例3: serializeClickActionLineGraphics_resultJsonHasClickAction
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeClickActionLineGraphics_resultJsonHasClickAction() throws IOException {
//when
Line line = new Line();
line.onClick(
new GraphicsActionListener() {
@Override
public void execute(GraphicsActionObject actionObject) {}
});
graphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("hasClickAction")).isTrue();
Assertions.assertThat(actualObj.get("hasClickAction").asBoolean()).isTrue();
}
示例4: serializeObject
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
public JsonNode serializeObject(V value) throws IOException {
StringWriter sw = new StringWriter();
JsonGenerator jgen = mapper.getFactory().createGenerator(sw);
serializer.serialize(value, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
return mapper.readTree(sw.toString());
}
示例5: serializeXOfXYGraphicsLine_resultJsonHasX
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeXOfXYGraphicsLine_resultJsonHasX() throws IOException {
//when
line.setX(Arrays.asList(1, 2, 3));
xyGraphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
Assertions.assertThat(actualObj.get("x")).isNotEmpty();
}
示例6: serializeBigIntXWithNanoPlotType_resultJsonHasStringX
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeBigIntXWithNanoPlotType_resultJsonHasStringX() throws IOException {
//when
line.setX(
Arrays.asList(
new BigInteger("12345678901234567891000"), new BigInteger("12345678901234567891000")));
line.setPlotType(NanoPlot.class);
xyGraphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("x");
Assertions.assertThat(arrayNode.get(1).isTextual()).isTrue();
}
示例7: serializeYOfXYGraphicsLine_resultJsonHasY
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeYOfXYGraphicsLine_resultJsonHasY() throws IOException {
//when
line.setY(Arrays.asList(1, 2, 3));
xyGraphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("y")).isTrue();
Assertions.assertThat(actualObj.get("y")).isNotEmpty();
}
示例8: serializeDataListListOfHistogram_resultJsonHasGraphicsList
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeDataListListOfHistogram_resultJsonHasGraphicsList() throws IOException {
//when
histogram.setData(Arrays.asList(Arrays.asList(1, 2), Arrays.asList(3, 4)));
histogramSerializer.serialize(histogram, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("graphics_list")).isTrue();
Assertions.assertThat(actualObj.get("graphics_list")).isNotEmpty();
}
示例9: serializeLodFilterOfXYGraphicsLine_resultJsonHasLodFilter
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeLodFilterOfXYGraphicsLine_resultJsonHasLodFilter() throws IOException {
//when
line.setLodFilter(Filter.LINE);
xyGraphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("lod_filter")).isTrue();
Assertions.assertThat(actualObj.get("lod_filter").asText()).isEqualTo("line");
}
示例10: serializeLogOfHistogram_resultJsonHasLog
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeLogOfHistogram_resultJsonHasLog() throws IOException {
//when
histogram.setLog(true);
histogramSerializer.serialize(histogram, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("log")).isTrue();
Assertions.assertThat(actualObj.get("log").asBoolean()).isTrue();
}
示例11: serializeConstantBand_resultJsonHasType
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeConstantBand_resultJsonHasType() throws IOException {
//when
ConstantBand constantBand = new ConstantBand();
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("type")).isTrue();
Assertions.assertThat(actualObj.get("type").asText()).isEqualTo("ConstantBand");
}
示例12: serializeDisplayModeOfHistogram_resultJsonHasDisplayMode
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeDisplayModeOfHistogram_resultJsonHasDisplayMode() throws IOException {
//when
histogram.setDisplayMode(Histogram.DisplayMode.STACK);
histogramSerializer.serialize(histogram, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("displayMode")).isTrue();
Assertions.assertThat(actualObj.get("displayMode").asText()).isEqualTo("STACK");
}
示例13: serializeNamesOfHistogram_resultJsonHasNames
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeNamesOfHistogram_resultJsonHasNames() throws IOException {
//when
histogram.setNames(Arrays.asList("name1", "name2"));
histogramSerializer.serialize(histogram, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("names")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("names");
Assertions.assertThat(arrayNode.get(1).asText()).isEqualTo("name2");
}
示例14: serializeVisibleConstantBand_resultJsonHasVisible
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeVisibleConstantBand_resultJsonHasVisible() throws IOException {
//when
ConstantBand constantBand = new ConstantBand();
constantBand.setVisible(true);
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("visible")).isTrue();
Assertions.assertThat(actualObj.get("visible").asBoolean()).isTrue();
}
示例15: serializeYAxisConstantBand_resultJsonHasYAxis
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; //导入依赖的package包/类
@Test
public void serializeYAxisConstantBand_resultJsonHasYAxis() throws IOException {
//when
ConstantBand constantBand = new ConstantBand();
constantBand.setyAxis("Y Axis name");
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
//then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("yAxis")).isTrue();
Assertions.assertThat(actualObj.get("yAxis").asText()).isEqualTo("Y Axis name");
}