Skip to content

Use TypeLiteral with Class<T> #218

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

Closed
mmaryo opened this issue Dec 9, 2018 · 0 comments
Closed

Use TypeLiteral with Class<T> #218

mmaryo opened this issue Dec 9, 2018 · 0 comments

Comments

@mmaryo
Copy link

mmaryo commented Dec 9, 2018

I would like to do

public <T> void method(String body, Class<T> clazz) { JsonIterator.deserialize(body, new TypeLiteral<List<clazz>>(){}); }

Is there other way to use Class ?

With Jackson we can do
TypeFactory.defaultInstance().constructParametrizedType(ArrayList.class, List.class, clazz));

@mmaryo mmaryo closed this as completed Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant