Add support for custom actions on annotations
See original GitHub issueSee the thread:
http://groups.google.com/group/google-gson/browse_thread/thread/1ea949a5e50cc507
by supporting a custom action on an annotation, we will enable support for
JPA/Hibernate and other kinds of annotations.
Original issue reported on code.google.com by inder123
on 26 Nov 2010 at 7:00
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:13
Top Results From Across the Web
How to Custom annotation tools with customized actions?
In my project we have a specific requirement of having customised tool. On tap it should add markers/location pins to the pdf at...
Read more >5 Creating Custom Actions for Your APIs - Oracle Help Center
Simply put, you create a custom action by creating and compiling the Java code, adding it to externalactions, and then restarting the Services...
Read more >Adding Custom Actions Using Extension Points - SAPUI5 SDK
In SAP Fiori elements for OData V4, footer bar actions are available only on the object page. These custom actions are displayed as...
Read more >Custom Actions Overview - Frame.io Docs
Custom actions are a way for you to build integrations directly into Frame.io as programmable UI components. This page explains how they work....
Read more >Enabling custom actions with a dialog for additional input fields
Actions with Parameters : In case a value help is added to an action parameter (e.g. via annotation @ValueHelpDefinition in corresponding ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, i want to share my implementation of custom annotation support for gson, which is backwards compatible: new
interface ParametrizedTypeAdapterFactory
extendsTypeAdapterFactory
and new method<T> TypeAdapter<T> create(Gson gson, TypeToken<T> type, Annotation[] annotations)
only gets called if field is annotated with specific annotation@Parametrized
I mostly wanted it for serializing some dates by specifying custom pattern in annotation like this:
Here is a draft implementation: https://github.com/amaksoft/gson/commit/b264334451c487d79241483103853c3fff27cbd4 Can you please review it?
Just wanted to explain my position:
ParamterizedTypeAdapterFactory
is just a special case ofTypeAdapterFactory
. In most casesGson
don’t even need to know that your factory accepts annotations. But in special cases like@CustomDateFormat
onDate
or@Id
onint
, you return a customizedTypeAdapter
only for this case, (we don’t cache it). No new lists of adapters needed, any of your existing TypeAdapters could be easily transformed into parametrized ones by implementing a new method.