public class JsonWritingUtils extends Object
| Constructor and Description |
|---|
JsonWritingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
shouldWriteField(String fieldName) |
static void |
writeMapEntries(JsonGenerator generator,
Map<?,?> map)
Writes entries of the map as fields.
|
static void |
writeMapStringFields(JsonGenerator generator,
String fieldName,
Map<String,String> map)
Writes a map as String fields to the generator if and only if the fieldName and values are not null.
|
static void |
writeMapStringFields(JsonGenerator generator,
String fieldName,
Map<String,String> map,
boolean lowerCaseKeys)
Writes a map as String fields to the generator if and only if the fieldName and values are not null.
|
static void |
writeNumberField(JsonGenerator generator,
String fieldName,
int fieldValue)
Writes the field to the generator if and only if the fieldName is not null.
|
static void |
writeNumberField(JsonGenerator generator,
String fieldName,
long fieldValue)
Writes the field to the generator if and only if the fieldName is not null.
|
static void |
writeStringField(JsonGenerator generator,
String fieldName,
String fieldValue)
Writes the field to the generator if and only if the fieldName and fieldValue are not null.
|
public static void writeMapEntries(JsonGenerator generator, Map<?,?> map) throws IOException, JsonMappingException
IOExceptionJsonMappingExceptionpublic static void writeMapStringFields(JsonGenerator generator, String fieldName, Map<String,String> map) throws IOException, JsonMappingException
IOExceptionJsonMappingExceptionpublic static void writeMapStringFields(JsonGenerator generator, String fieldName, Map<String,String> map, boolean lowerCaseKeys) throws IOException, JsonMappingException
lowerCaseKeys - when true, the map keys will be written in lowercase.IOExceptionJsonMappingExceptionpublic static void writeStringField(JsonGenerator generator, String fieldName, String fieldValue) throws IOException
IOExceptionpublic static void writeNumberField(JsonGenerator generator, String fieldName, int fieldValue) throws IOException
IOExceptionpublic static void writeNumberField(JsonGenerator generator, String fieldName, long fieldValue) throws IOException
IOExceptionpublic static boolean shouldWriteField(String fieldName)
Copyright © 2019. All rights reserved.