Annotation Interface EnableFieldFilter


@Target(TYPE) @Retention(RUNTIME) public @interface EnableFieldFilter
Enables field filtering for the annotated resource when rendered in a response. Clients may request a lighter response containing only requested fields and HAL links or embedded resources instead of the complete model.

If an annotated resource has three properties:

   @EnableFieldFilter
   public class Person {
     private String firstName;
     private String surName;
     private String nickName;
     // ...
   }
 

And the client requests GET /person/ID?fields=firstName,surName or GET /person/ID?fields=firstName&fields=surName, the returned Json will be:

   {
     "firstName": "John",
     "surName": "Doe"
   }
 

The JacksonFieldFilterModule has to be registered after the JacksonHALModule is added to the ObjectMapper. Both can be accomplished in appropriate order, using the JacksonConfigurationBundle.