@@ -0,0 +1,2996 @@
+package com.idogfooding.backbone.utils;%0A%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.GsonBuilder;%0A%0Aimport java.io.Reader;%0Aimport java.lang.reflect.Type;%0A%0A/**%0A * Gson utilities.%0A */%0Apublic abstract class GsonUtils %7B%0A%0A    private static final Gson GSON = createGson(true);%0A%0A    private static final Gson GSON_NO_NULLS = createGson(false);%0A%0A    /**%0A     * Create the standard %7B@link Gson%7D configuration%0A     *%0A     * @return created gson, never null%0A     */%0A    public static final Gson createGson() %7B%0A        return createGson(true);%0A    %7D%0A%0A    /**%0A     * Create the standard %7B@link Gson%7D configuration%0A     *%0A     * @param serializeNulls%0A     *            whether nulls should be serialized%0A     *%0A     * @return created gson, never null%0A     */%0A    public static final Gson createGson(final boolean serializeNulls) %7B%0A        final GsonBuilder builder = new GsonBuilder();%0A        if (serializeNulls)%0A            builder.serializeNulls();%0A        return builder.create();%0A    %7D%0A%0A    /**%0A     * Get reusable pre-configured %7B@link Gson%7D instance%0A     *%0A     * @return Gson instance%0A     */%0A    public static final Gson getGson() %7B%0A        return GSON;%0A    %7D%0A%0A    /**%0A     * Get reusable pre-configured %7B@link Gson%7D instance%0A     *%0A     * @param serializeNulls%0A     * @return Gson instance%0A     */%0A    public static final Gson getGson(final boolean serializeNulls) %7B%0A        return serializeNulls ? GSON : GSON_NO_NULLS;%0A    %7D%0A%0A    /**%0A     * Convert object to json%0A     *%0A     * @param object%0A     * @return json string%0A     */%0A    public static final String toJson(final Object object) %7B%0A        return toJson(object, true);%0A    %7D%0A%0A    /**%0A     * Convert object to json%0A     *%0A     * @param object%0A     * @param includeNulls%0A     * @return json string%0A     */%0A    public static final String toJson(final Object object,%0A                                      final boolean includeNulls) %7B%0A        return includeNulls ? GSON.toJson(object) : GSON_NO_NULLS.toJson(object);%0A    %7D%0A%0A    /**%0A     * Convert string to given type%0A     *%0A     * @param json%0A     * @param type%0A     * @return instance of type%0A     */%0A    public static final %3CV%3E V fromJson(String json, Class%3CV%3E type) %7B%0A        return GSON.fromJson(json, type);%0A    %7D%0A%0A    /**%0A     * Convert string to given type%0A     *%0A     * @param json%0A     * @param type%0A     * @return instance of type%0A     */%0A    public static final %3CV%3E V fromJson(String json, Type type) %7B%0A        return GSON.fromJson(json, type);%0A    %7D%0A%0A    /**%0A     * Convert content of reader to given type%0A     *%0A     * @param reader%0A     * @param type%0A     * @return instance of type%0A     */%0A    public static final %3CV%3E V fromJson(Reader reader, Class%3CV%3E type) %7B%0A        return GSON.fromJson(reader, type);%0A    %7D%0A%0A    /**%0A     * Convert content of reader to given type%0A     *%0A     * @param reader%0A     * @param type%0A     * @return instance of type%0A     */%0A    public static final %3CV%3E V fromJson(Reader reader, Type type) %7B%0A        return GSON.fromJson(reader, type);%0A    %7D%0A%7D

add gson utils