Annotation Interface JsonApiMeta


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface JsonApiMeta
Marks a field or method for inclusion in the JSON:API meta object.

Fields or setter/getter methods annotated with @JsonApiMeta will be serialized to and deserialized from the meta member of a JSON:API resource object. The meta object can contain any non-standard information about a resource.

During serialization, the annotated field value becomes a property in the meta object. During deserialization, values from the meta object are mapped back to the annotated fields.

Example usage:


 public class Movie {
   private String title;

   @JsonApiMeta
   private String copyright;

   @JsonApiMeta
   private int viewCount;
 }

 // Results in JSON:API:
 {
   "data": {
     "type": "movies",
     "id": "1",
     "attributes": {
       "title": "The Matrix"
     },
     "meta": {
       "copyright": "Warner Bros",
       "viewCount": 1000000
     }
   }
 }
 
See Also: