Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gson's @Expose annotation #12

Open
robfletcher opened this issue Feb 18, 2013 · 6 comments
Open

Support Gson's @Expose annotation #12

robfletcher opened this issue Feb 18, 2013 · 6 comments

Comments

@robfletcher
Copy link
Owner

No description provided.

@beckje01
Copy link
Contributor

Would you like a different converter that supports the @Expose or do you want the current converter to be driven by a config option?

@robfletcher
Copy link
Owner Author

Good question. I hadn't really given it much thought. It doesn't feel like much would need to be different other than the mechanism for selecting the properties to iterate over. There are a couple of side-questions such as what happens if you add @Expose to a transient non-persistent property?

@beckje01
Copy link
Contributor

The only reason you might want a different converter is if you wanted to be able to both do a as GSON that does the whole object as well as a as ExposedGSON that only shows the items with @Expose

As far as transient non-persistent property I haven't really tested with that in mind could it even be the same annotation?

@robfletcher
Copy link
Owner Author

Yeah, a different converter might make sense if you wanted to handle different classes with one or other mechanism. I think creating a different JsonSerializer / JsonDeserializer class might make sense. Another option would be refactoring the existing code to use an exclusion strategy.

@beckje01
Copy link
Contributor

Just a quick idea what do you think of this I can put together a pull request if you like it https://gist.github.com/beckje01/5145266

@jrgleason
Copy link

I just noticed @exclude wasn't working for me. Do the other annotations function as expected? Will this ever be resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants