fkrauthan
01/09/2019, 8:33 PMtKw
01/09/2019, 8:51 PMfkrauthan
01/09/2019, 9:29 PMfkrauthan
01/09/2019, 9:31 PMMappingJacksonValue
instance as my return entity. Which takes in the entity object and a view class to use. And the serialized that entity with respecting the view class to jsontKw
01/09/2019, 9:52 PMtKw
01/09/2019, 9:52 PMtKw
01/09/2019, 9:54 PMfkrauthan
01/09/2019, 9:54 PMtKw
01/09/2019, 9:55 PMtKw
01/09/2019, 9:56 PMtKw
01/09/2019, 9:56 PMfkrauthan
01/09/2019, 10:00 PMclass User {
@JsonView(Public.class)
private String id;
@JsonView(Public.class)
private String name;
@JsonView(Private.class)
private String email;
}
@Get("/profile/{id}")
public MappingJacksonValue getProfile(String id, Principal p) {
User user = loadUserById(id);
return new MappingJacksonValue(user, user.id.equals(p.getId()) ? Private.class : Public.class);
}
fkrauthan
01/09/2019, 10:01 PMAlexander Mikhalchenko
01/10/2019, 6:56 AMfkrauthan
01/10/2019, 5:13 PM