JSONLibDataFormatSerializer.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
@SuppressWarnings("deprecation")
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
    if (object == null) {
        serializer.out.writeNull();
        return;
    }

    Date date = (Date) object;

    JSONObject json = new JSONObject();
    json.put("date", date.getDate());
    json.put("day", date.getDay());
    json.put("hours", date.getHours());
    json.put("minutes", date.getMinutes());
    json.put("month", date.getMonth());
    json.put("seconds", date.getSeconds());
    json.put("time", date.getTime());
    json.put("timezoneOffset", date.getTimezoneOffset());
    json.put("year", date.getYear());

    serializer.write(json);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号