Class GsonUtils
java.lang.Object
org.spongepowered.plugin.metadata.util.GsonUtils
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidapplyIfValid(JsonObject obj, T value, Predicate<T> validator, BiConsumer<JsonObject, T> consumer) static <T extends JsonElement>
voidconsumeIfPresent(JsonObject obj, String key, Consumer<T> consumer) static <T> Optional<T>get(JsonObject obj, String key, Function<JsonElement, T> valFunc) static <T,V extends Collection<T>> 
Vread(JsonArray in, TypeAdapter<T> adapter, Supplier<V> collector) read(JsonObject in, Function<JsonElement, Object> valFunc, Supplier<Map<String, Object>> collector) static <T> JsonArraywrite(TypeAdapter<T> adapter, Collection<T> value) static JsonObjectstatic <T> voidwriteIfPresent(JsonObject out, String key, Optional<T> value) static <T> voidwriteIfPresent(JsonWriter out, String name, Optional<T> value)  
- 
Constructor Details
- 
GsonUtils
public GsonUtils() 
 - 
 - 
Method Details
- 
read
public static <T,V extends Collection<T>> V read(JsonArray in, TypeAdapter<T> adapter, Supplier<V> collector)  - 
read
 - 
write
 - 
write
 - 
writeIfPresent
public static <T> void writeIfPresent(JsonWriter out, String name, Optional<T> value) throws IOException - Throws:
 IOException
 - 
writeIfPresent
 - 
consumeIfPresent
public static <T extends JsonElement> void consumeIfPresent(JsonObject obj, String key, Consumer<T> consumer)  - 
applyIfValid
public static <T> void applyIfValid(JsonObject obj, T value, Predicate<T> validator, BiConsumer<JsonObject, T> consumer)  - 
get
 
 -