Package org.apache.iceberg.util
Class JsonUtil
java.lang.Object
org.apache.iceberg.util.JsonUtil
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface
- 
Method SummaryModifier and TypeMethodDescriptionstatic com.fasterxml.jackson.core.JsonFactoryfactory()static Stringgenerate(JsonUtil.ToJson toJson, boolean pretty) Helper for writing JSON with a JsonGenerator.static com.fasterxml.jackson.databind.JsonNodestatic booleanstatic BooleangetBoolOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static ByteBuffergetByteBufferOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static intstatic int[]getIntArrayOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) getIntegerList(String property, com.fasterxml.jackson.databind.JsonNode node) getIntegerSet(String property, com.fasterxml.jackson.databind.JsonNode node) getIntegerSetOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static IntegergetIntOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static longgetLongList(String property, com.fasterxml.jackson.databind.JsonNode node) getLongListOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static LonggetLongOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) getLongSet(String property, com.fasterxml.jackson.databind.JsonNode node) getLongSetOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static <T> List<T> getObjectList(String property, com.fasterxml.jackson.databind.JsonNode node, JsonUtil.FromJson<T> fromJson) static <T> List<T> getObjectListOrNull(String property, com.fasterxml.jackson.databind.JsonNode node, JsonUtil.FromJson<T> fromJson) static Stringstatic String[]getStringArray(com.fasterxml.jackson.databind.JsonNode node) getStringList(String property, com.fasterxml.jackson.databind.JsonNode node) getStringListOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) getStringMap(String property, com.fasterxml.jackson.databind.JsonNode node) getStringMapNullableValues(String property, com.fasterxml.jackson.databind.JsonNode node) getStringMapOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) static StringgetStringOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) getStringSet(String property, com.fasterxml.jackson.databind.JsonNode node) static com.fasterxml.jackson.databind.ObjectMappermapper()static <T> Tparse(String json, JsonUtil.FromJson<T> parser) Helper for parsing JSON from a String.static voidwriteIntegerArray(String property, Iterable<Integer> items, com.fasterxml.jackson.core.JsonGenerator gen) static voidwriteIntegerFieldIf(boolean condition, String key, Integer value, com.fasterxml.jackson.core.JsonGenerator generator) static voidwriteIntegerFieldIfPresent(String key, Integer value, com.fasterxml.jackson.core.JsonGenerator generator) static voidwriteLongArray(String property, Iterable<Long> items, com.fasterxml.jackson.core.JsonGenerator gen) static voidwriteLongFieldIf(boolean condition, String key, Long value, com.fasterxml.jackson.core.JsonGenerator generator) static voidwriteLongFieldIfPresent(String key, Long value, com.fasterxml.jackson.core.JsonGenerator generator) static voidwriteStringArray(String property, Iterable<String> items, com.fasterxml.jackson.core.JsonGenerator gen) static voidwriteStringFieldIfPresent(String key, String value, com.fasterxml.jackson.core.JsonGenerator generator) static voidwriteStringMap(String property, Map<String, String> map, com.fasterxml.jackson.core.JsonGenerator gen) 
- 
Method Details- 
factorypublic static com.fasterxml.jackson.core.JsonFactory factory()
- 
mapperpublic static com.fasterxml.jackson.databind.ObjectMapper mapper()
- 
generateHelper for writing JSON with a JsonGenerator.- Parameters:
- toJson- a function to produce JSON using a JsonGenerator
- pretty- whether to pretty-print JSON for readability
- Returns:
- a JSON string produced from the generator
 
- 
parseHelper for parsing JSON from a String.- Type Parameters:
- T- type of objects created by the parser
- Parameters:
- json- a JSON string
- parser- a function that converts a JsonNode to a Java object
- Returns:
- the parsed Java object
 
- 
getpublic static com.fasterxml.jackson.databind.JsonNode get(String property, com.fasterxml.jackson.databind.JsonNode node) 
- 
getInt
- 
getIntOrNull
- 
getLongOrNull
- 
getLong
- 
getBoolOrNull
- 
getBool
- 
getString
- 
getStringOrNull
- 
getByteBufferOrNullpublic static ByteBuffer getByteBufferOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) 
- 
getStringMapOrNull
- 
getStringMap
- 
getStringMapNullableValues
- 
getStringArray
- 
getStringList
- 
getStringSet
- 
getStringListOrNull
- 
getIntArrayOrNullpublic static int[] getIntArrayOrNull(String property, com.fasterxml.jackson.databind.JsonNode node) 
- 
getIntegerList
- 
getIntegerSetOrNull
- 
getIntegerSet
- 
getLongList
- 
getLongListOrNull
- 
getLongSetOrNull
- 
getLongSet
- 
writeIntegerFieldIfpublic static void writeIntegerFieldIf(boolean condition, String key, Integer value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
- IOException
 
- 
writeIntegerFieldIfPresentpublic static void writeIntegerFieldIfPresent(String key, Integer value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
- IOException
 
- 
writeLongFieldIfpublic static void writeLongFieldIf(boolean condition, String key, Long value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
- IOException
 
- 
writeLongFieldIfPresentpublic static void writeLongFieldIfPresent(String key, Long value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
- IOException
 
- 
writeStringFieldIfPresentpublic static void writeStringFieldIfPresent(String key, String value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
- IOException
 
- 
getObjectListOrNullpublic static <T> List<T> getObjectListOrNull(String property, com.fasterxml.jackson.databind.JsonNode node, JsonUtil.FromJson<T> fromJson) 
- 
getObjectListpublic static <T> List<T> getObjectList(String property, com.fasterxml.jackson.databind.JsonNode node, JsonUtil.FromJson<T> fromJson) 
- 
writeIntegerArraypublic static void writeIntegerArray(String property, Iterable<Integer> items, com.fasterxml.jackson.core.JsonGenerator gen) throws IOException - Throws:
- IOException
 
- 
writeLongArraypublic static void writeLongArray(String property, Iterable<Long> items, com.fasterxml.jackson.core.JsonGenerator gen) throws IOException - Throws:
- IOException
 
- 
writeStringArraypublic static void writeStringArray(String property, Iterable<String> items, com.fasterxml.jackson.core.JsonGenerator gen) throws IOException - Throws:
- IOException
 
- 
writeStringMappublic static void writeStringMap(String property, Map<String, String> map, com.fasterxml.jackson.core.JsonGenerator gen) throws IOException- Throws:
- IOException
 
 
-