Created
September 3, 2012 22:41
-
-
Save pulkitsinghal/3614268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.LinkedList; | |
| /** | |
| * I'm employing this super-hacky class which breaks the Java | |
| * class uppercasing conventions because, I want to get the following JSON: | |
| { | |
| "products":[ | |
| {...}, | |
| {...} | |
| ] | |
| } | |
| * | |
| * 1) BUT with code: | |
| * @Produces(MediaType.APPLICATION_JSON) | |
| * public Product[] ... { | |
| * resource.get(new GenericType<List<Product>>(){}); | |
| * return products_response.toArray(new Product[0]); | |
| * } | |
| { | |
| "Product[]":[ | |
| {...}, | |
| {...} | |
| ] | |
| } | |
| * | |
| * 2) AND with code: | |
| * @Produces(MediaType.APPLICATION_JSON) | |
| * public List<Product> ... { | |
| * resource.get(new GenericType<List<Product>>(){}); | |
| * return products_response; | |
| * } | |
| * The JSON tends to come out looking like: | |
| { | |
| "List":[ | |
| {...}, | |
| {...} | |
| ] | |
| } | |
| * None of which is in the desired form. | |
| * | |
| * @author pulkitsinghal | |
| * | |
| */ | |
| public class products<E> extends LinkedList<E> { | |
| private static final long serialVersionUID = 4433491566929410574L; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment