public final class JSONUtil
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
JSONUtil.JSONPair |
Simply stores a key and a value, used internally by many methods below.
|
| Modifier and Type | Method | Description |
|---|---|---|
static java.util.Map |
appendObjectData(java.util.Map parent,
JSONUtil.JSONPair... data) |
This appends multiple key/value Obj pairs into a JSON Object
|
static java.util.Map |
createObject(JSONUtil.JSONPair... data) |
Creates a new JSON object from multiple JSONPair key/value pairs
|
static JSONUtil.JSONPair |
pair(long key,
java.lang.Object obj) |
|
static JSONUtil.JSONPair |
pair(java.lang.String key,
java.lang.Object obj) |
Creates a key/value "JSONPair" object
|
static java.util.List |
toArray(java.lang.Object... data) |
This builds a JSON array from a set of data
|
static <E> java.util.List |
toArrayMapper(E[] collection,
com.google.common.base.Function<E,java.lang.Object> mapper) |
These help build a single JSON array using a mapper function
|
static <E> java.util.List |
toArrayMapper(java.lang.Iterable<E> collection,
com.google.common.base.Function<E,java.lang.Object> mapper) |
|
static <E> java.util.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> java.util.Map |
toObjectMapper(java.lang.Iterable<E> collection,
com.google.common.base.Function<E,JSONUtil.JSONPair> mapper) |
public static JSONUtil.JSONPair pair(java.lang.String key, java.lang.Object obj)
key - Key to useobj - Value to usepublic static JSONUtil.JSONPair pair(long key, java.lang.Object obj)
public static java.util.Map createObject(JSONUtil.JSONPair... data)
data - JSONPairspublic static java.util.Map appendObjectData(java.util.Map parent,
JSONUtil.JSONPair... data)
parent - Map to be appended todata - Data to appendpublic static java.util.List toArray(java.lang.Object... data)
data - Data to build JSON array frompublic static <E> java.util.List toArrayMapper(E[] collection,
com.google.common.base.Function<E,java.lang.Object> mapper)
E - Element Typecollection - Collection to apply tomapper - Mapper to applypublic static <E> java.util.List toArrayMapper(java.lang.Iterable<E> collection,
com.google.common.base.Function<E,java.lang.Object> mapper)
public static <E> java.util.Map toObjectMapper(E[] collection,
com.google.common.base.Function<E,JSONUtil.JSONPair> mapper)
E - Element Typecollection - Collection to apply tomapper - Mapper to applypublic static <E> java.util.Map toObjectMapper(java.lang.Iterable<E> collection,
com.google.common.base.Function<E,JSONUtil.JSONPair> mapper)
Copyright © 2018. All rights reserved.