Wednesday, 3 December 2014

Want to show certain fields/elements in one operation but not in other



I am making a web service in NetBeans in Java. I have a class Game with the following fields:



private String name;
private double price;
private String category;
private double rating;
private String releaseDate;
private Requirements requirements;
private String description;


The service will have two operations - getGameList and getGameDetails. The problem I am having is that I want to show all the above fields/elements in the getGameDetails response but I wish to show only a selection of the fields/elements (namely name, price and category) in the getGameList operation. I thought one way would be to make two different Game classes for a list search and detail search but I am just asking here to make sure there isn't some obscure method that would let me use the same Game class for both operations.


No comments:

Post a Comment