Search in sources :

Example 11 with FastJsonView

use of com.alibaba.fastjson.support.spring.annotation.FastJsonView in project fastjson by alibaba.

the class FastJsonViewAndJSONPControllerTest method test1.

@ResponseJSONP
@RequestMapping("test1")
@FastJsonView(include = { @FastJsonFilter(clazz = Company.class, props = { "id", "name" }) })
public Company test1() {
    Company company = new Company();
    company.setId(100L);
    company.setName("测试");
    company.setDescription("fastjsonview注解测试");
    company.setStock("haha");
    return company;
}
Also used : Company(com.alibaba.json.test.entity.Company) FastJsonView(com.alibaba.fastjson.support.spring.annotation.FastJsonView) ResponseJSONP(com.alibaba.fastjson.support.spring.annotation.ResponseJSONP) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with FastJsonView

use of com.alibaba.fastjson.support.spring.annotation.FastJsonView in project fastjson by alibaba.

the class FastJsonViewAndJSONPControllerTest method test2.

@ResponseJSONP
@RequestMapping("test2")
@FastJsonView(exclude = { @FastJsonFilter(clazz = Company.class, props = { "id", "name" }) })
public Company test2() {
    Company company = new Company();
    company.setId(100L);
    company.setName("测试");
    company.setDescription("fastjsonview注解测试");
    company.setStock("haha");
    return company;
}
Also used : Company(com.alibaba.json.test.entity.Company) FastJsonView(com.alibaba.fastjson.support.spring.annotation.FastJsonView) ResponseJSONP(com.alibaba.fastjson.support.spring.annotation.ResponseJSONP) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

FastJsonView (com.alibaba.fastjson.support.spring.annotation.FastJsonView)12 Company (com.alibaba.json.test.entity.Company)10 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6 Department (com.alibaba.json.test.entity.Department)5 ResponseJSONP (com.alibaba.fastjson.support.spring.annotation.ResponseJSONP)4 FastJsonFilter (com.alibaba.fastjson.support.spring.annotation.FastJsonFilter)2