julman99 / gson-fire

A java library that adds some very useful features to Gson, like Date serializing to unix timestamp or RFC3339, method (getters) serialization, pre/post processors and many others. Check out the documentation to learn how to use it!
http://gsonfire.io
Other
229 stars 37 forks source link

Adds exclude by value strategies #16

Closed joaocpsantos closed 9 years ago

joaocpsantos commented 9 years ago

This PR allows to remove attributes from the serialized JSON, based on the evaluation of a strategy defined with an attribute annotation. In order to get the field name, we have to access private attributes of gson classes to get the FieldNamingStrategy. After getting it, it is cached and we keep using it instead of getting it again.

joaocpsantos commented 9 years ago

Updated, added a FieldNameResolver that resolves and caches field names.

joaocpsantos commented 9 years ago

Updated. Considering we may have multiple Gsons with multiple FieldNamingStrategies, then, we need multiple caches for each FieldNamingStrategy. Since for each strategy we want a single cache, access to creating the cache must be synchronized.

joaocpsantos commented 9 years ago

Added ConcurrentWeakHashMap from grizzly-utils 1.9.62.

joaocpsantos commented 9 years ago

:+1:

julman99 commented 9 years ago

:+1: I think this is a very nice feature!