diff options
author | Simon Rettberg | 2014-06-03 16:44:56 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-06-03 16:44:56 +0200 |
commit | efb5ad9f5fe48a77b6cd14e7bd2b25e3b13ecb1f (patch) | |
tree | ab7310095194cea2a74acd8aac782b1ec95e508d /daemon/src/main/java/org/openslx/taskmanager/util/Util.java | |
download | taskman-lite-efb5ad9f5fe48a77b6cd14e7bd2b25e3b13ecb1f.tar.gz taskman-lite-efb5ad9f5fe48a77b6cd14e7bd2b25e3b13ecb1f.tar.xz taskman-lite-efb5ad9f5fe48a77b6cd14e7bd2b25e3b13ecb1f.zip |
Initial commit
Diffstat (limited to 'daemon/src/main/java/org/openslx/taskmanager/util/Util.java')
-rw-r--r-- | daemon/src/main/java/org/openslx/taskmanager/util/Util.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/daemon/src/main/java/org/openslx/taskmanager/util/Util.java b/daemon/src/main/java/org/openslx/taskmanager/util/Util.java new file mode 100644 index 0000000..bf52ecb --- /dev/null +++ b/daemon/src/main/java/org/openslx/taskmanager/util/Util.java @@ -0,0 +1,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(); + } + +} |