首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > 基于JSON序列化程序模板

基于JSON序列化程序模板

  • 资源大小:6.41 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: 模板 程序 json 基于 序列化

资 源 简 介

Jsonizer is a light-weight JSON serializer. Concept Template engine like XSLT. Type-safe mapping. No reflection. Getting Started Download jsonizer-0.9.jar and place it into /WEB-INF/lib. JSON serialization needs three steps: Instantiate a Jsonizer object. Define templates. Serialize an object to JSON. ``` public class ExampleServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { Jsonizer jsonizer = new Jsonizer(); // define a template for class Hoge here jsonizer.type(Hoge.class).with(new PropertyGetter() { public void get(Hoge m) { // mappings between the object and JSON property property(Datastore.keyToString(e.getKey())).as("key"); property(e.getUrl()).as("url"); property(e.getDate().getTime()).as("date"); } }); // object to s
VIP VIP
0.171917s