We are using some JSON-B annotations to customize our user data representation:
@JsonbProperty("fullName") private String name;
The @JsonbProperty is used to change the field name to some other value:
@JsonbTransient private Double privateNumber;
Use @JsonbTransient when you want to prevent some property appearing at the JSON representation:
@JsonbDateFormat(JsonbDateFormat.DEFAULT_LOCALE) private Date dateCreated;
With @JsonbDateFormat, you use the API to automatically format your dates.
And then we use our UI manager to update the view:
public void loadUser(){ long now = System.currentTimeMillis(); User user = new User(now, "User" + now, "user" + now + "@eldermoraes.com", Math.random(), new Date()); Jsonb jb = JsonbBuilder.create(); ...