mirror of
https://github.com/ralscha/extdirectspring.git
synced 2026-10-09 09:18:19 +02:00
Page:
@JsonView
Pages
@JsonView
Api
Changelog
Changelog1_0_x
Changelog1_1_x
Changelog1_2_x
Changelog1_3_x
Changelog1_4_x
Changelog1_5_x
Changelog1_6_x
Config Spring Java Config
Config SpringXML
Configuration
Development
Form Load Method
Form Post Exception Handling
Form Post Method
Form Post Method1_0_x
Form Post Method1_1_x
Form Post With Upload
Form Post With Upload1_0_x
Form Post With Upload1_1_x
Home
Links
Migraton1_0_to_1_1
ModelGenerator
ModelGeneratorAPT
Polling Method
SSE Method
Setting Up Spring Java
Setup Maven
Simple Method
Simple Named Parameter Method
Store Modify Method
Store Read Method
Tree Load Method
No results
2
@JsonView
İlhan Subaşı edited this page 2019-11-26 10:38:21 +03:00
(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
Table of Contents
- Introduction
- Changelog 1.7.x
- Setup Maven
- Configuration
- Server Methods
- Model Generator
- Model Generator APT
- Development
- Links