title: Exclude some field from object while return
body: <p>I have object that have attributes <code>id, name, description</code>.</p>
  
  <p>In some case i want to return whole object but in some i want to return only <code>id</code>, suppose when I insert new record it should only return id that is newly generated.</p>
  
  <pre><code>public class DTO {
      private Integer id;
      private String name;
      private String description;
      // getter-setter
  }
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>@RequestMapping(value = "/{cname}/met", method = RequestMethod.POST)
  @ResponseBody
  public DTO addMet(@PathVariable String  cname, @RequestBody DTO met) {
      return service.addMet(met); // service return whole DTO object that is newly added with new Id
  }
  </code></pre>
  
  <p>I want to return only <code>id</code> as response, so any help or guidance on it that how to do so ?</p>
  
  <p>Thank you.</p>