summaryrefslogtreecommitdiffstats
path: root/daemon/src/main/java/org/openslx/taskmanager/util/Util.java
blob: bf52ecb3e406c75ad189f73e71da76390b4db3b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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();
	}

}