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)
	public Employee getEmployee() {
		Employee e = new Employee();
		return e;
	}
	@ExtDirectMethod
	public ModelAndJsonView getEmployee() {
		Employee e = new Employee();
		return new ModelAndJsonView(e, Views.Detail.class);
	}
	@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ)
	public ExtDirectStoreResult<Employee> employees() {
		List<Employee> listOfEmployess = ....
		ExtDirectStoreResult<Employee> result = new ExtDirectStoreResult<>(listOfEmployess);
		result.setJsonView(Views.Summary.class);
		return result;
	}

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