Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

the `<Book>` generic type doesn't translate to anything at run time, so you cannot actually parse the json out as a book class, unless you already knew it was going to be a Book. The parse() method cannot be generic over all possible inputs as is - unless the user also pass in the `Book.class` parameter!


You can use something like `new JsonParser<Book>(){}.parse(json)`

Not saying that's a good idea, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: