## org.plovr
Class GsonUtil

    java.lang.Object
      org.plovr.GsonUtil

    public final class GsonUtil

extends java.lang.Object

`GsonUtil` provides utilities for working with `Gson`.

Author:
  bolinfest@gmail.com (Michael Bolin)

Field Summary
`static Function<java.lang.String,JsonPrimitive>` `STRING_TO_JSON_PRIMITIVE`

Method Summary
`static JsonObject` `clone(JsonObject value)`
`static java.lang.String` `stringOrNull(JsonElement element)` If element is a `JsonPrimitive` that corresponds to a string, then return the value of that string; otherwise, return null.
`static java.util.List<java.lang.String>` `toListOfStrings(JsonElement element)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### STRING_TO_JSON_PRIMITIVE

    public static final Function<java.lang.String,JsonPrimitive> STRING_TO_JSON_PRIMITIVE

Method Detail

### stringOrNull

    public static java.lang.String stringOrNull(JsonElement element)

  If element is a `JsonPrimitive` that corresponds to a string, then return the value of that string; otherwise, return null.

### toListOfStrings

    public static java.util.List<java.lang.String> toListOfStrings(JsonElement element)
                                                            throws java.lang.IllegalArgumentException

  Parameters:
    `element` - must be one of:
    - `null`, in which case this returns `null`
    - a single string literal
    - a list of non-null string literals
  Returns:
    null or a list of non-null strings
  Throws:
    `java.lang.IllegalArgumentException` - if `element` does not meet any of the above conditions

### clone

    public static JsonObject clone(JsonObject value)