blob: bf52ecb3e406c75ad189f73e71da76390b4db3b4 (
plain) (
tree)
|
|
package org.openslx.taskmanager.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class Util
{
private static GsonBuilder gsonBuilder = new GsonBuilder();
/**
* Small helper to create a gson instance that will only handle class members with the
* "@Exposed" annotation. Decided against the default of explicitly excluding fields by
* making them transient, as you might easily forget to exclude an important field, which
* can in turn be a security issue.
*
* @return Gson instance
*/
public static Gson explicitGsonInstance()
{
return gsonBuilder.excludeFieldsWithoutExposeAnnotation().create();
}
}
|