Package org.sdase.commons.server.jackson
Annotation Type 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
orGET /person/ID?fields=firstName&fields=surName
, the returned Json will be:{ "firstName": "John", "surName": "Doe" }
The
JacksonFieldFilterModule
has to be registered after theJacksonHALModule
is added to theObjectMapper
. Both can be accomplished in appropriate order, using theJacksonConfigurationBundle
.