public final class JSONUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JSONUtil.JSONPair
Simply stores a key and a value, used internally by many methods below.
|
Modifier and Type | Method and Description |
---|---|
static Map |
appendObjectData(Map parent,
JSONUtil.JSONPair... data)
This appends multiple key/value Obj pairs into a JSON Object
|
static Map |
createObject(JSONUtil.JSONPair... data)
Creates a new JSON object from multiple JsonPair key/value pairs
|
static JSONUtil.JSONPair |
pair(long key,
Object obj) |
static JSONUtil.JSONPair |
pair(String key,
Object obj)
Creates a key/value "JSONPair" object
|
static List |
toArray(Object... data)
This builds a JSON array from a set of data
|
static <E> List |
toArrayMapper(E[] collection,
com.google.common.base.Function<E,Object> mapper)
These help build a single JSON array using a mapper function
|
static <E> List |
toArrayMapper(Iterable<E> collection,
com.google.common.base.Function<E,Object> mapper) |
static <E> Map |
toObjectMapper(E[] collection,
com.google.common.base.Function<E,JSONUtil.JSONPair> mapper)
These help build a single JSON Object from a collection, using a mapper function
|
static <E> Map |
toObjectMapper(Iterable<E> collection,
com.google.common.base.Function<E,JSONUtil.JSONPair> mapper) |
public static JSONUtil.JSONPair pair(String key, Object obj)
key
- obj
- public static JSONUtil.JSONPair pair(long key, Object obj)
public static Map createObject(JSONUtil.JSONPair... data)
data
- public static Map appendObjectData(Map parent, JSONUtil.JSONPair... data)
parent
- data
- public static List toArray(Object... data)
data
- public static <E> List toArrayMapper(E[] collection, com.google.common.base.Function<E,Object> mapper)
E
- collection
- mapper
- public static <E> List toArrayMapper(Iterable<E> collection, com.google.common.base.Function<E,Object> mapper)
public static <E> Map toObjectMapper(E[] collection, com.google.common.base.Function<E,JSONUtil.JSONPair> mapper)
E
- collection
- mapper
- public static <E> Map toObjectMapper(Iterable<E> collection, com.google.common.base.Function<E,JSONUtil.JSONPair> mapper)
Copyright © 2022. All rights reserved.