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