Skip to content
İlhan Subaşı edited this page Nov 26, 2019 · 2 revisions

(since 1.3.6)

Support for Jackson's @JsonView feature.

The ExtDirectMethod annotation contains an attribute jsonView to specify the json view class in a static way.

To specify the view in a dynamic way a extdirect method may return an instance of the new class ModelAndJsonView or set the new jsonView property in one of the result classes (ExtDirectFormLoadResult and ExtDirectStoreResult)

@ExtDirectMethod(jsonView = Views.Summary.class)
publicEmployeegetEmployee() {
Employeee = newEmployee();
returne;
}
@ExtDirectMethodpublicModelAndJsonViewgetEmployee() {
Employeee = newEmployee();
returnnewModelAndJsonView(e, Views.Detail.class);
}
@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ)
publicExtDirectStoreResult<Employee> employees() {
List<Employee> listOfEmployess = ....
ExtDirectStoreResult<Employee> result = newExtDirectStoreResult<>(listOfEmployess);
result.setJsonView(Views.Summary.class);
returnresult;
}

A jsonView specified with ModelAndJsonView or in one of the result classes overrides the jsonView specified on the ExtDirectMethod annotation.

This is supported in all extdirect methods except FORM_POST and SSE

Clone this wiki locally