AndBase开发框架  1.6
 全部  命名空间 文件 函数 变量 枚举值 
Public 成员函数 | 包函数 | Private 成员函数 | Private 属性 | 所有成员列表
com.google.gson.DefaultDateTypeAdapter类 参考
类 com.google.gson.DefaultDateTypeAdapter 继承关系图:
com.google.gson.JsonSerializer< T > com.google.gson.JsonDeserializer< T >

Public 成员函数

 DefaultDateTypeAdapter (int dateStyle, int timeStyle)
 
JsonElement serialize (Date src, Type typeOfSrc, JsonSerializationContext context)
 
Date deserialize (JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
 
String toString ()
 
- Public 成员函数 继承自 com.google.gson.JsonSerializer< T >
JsonElement serialize (T src, Type typeOfSrc, JsonSerializationContext context)
 

包函数

 DefaultDateTypeAdapter ()
 
 DefaultDateTypeAdapter (String datePattern)
 
 DefaultDateTypeAdapter (int style)
 
 DefaultDateTypeAdapter (DateFormat enUsFormat, DateFormat localFormat)
 

Private 成员函数

Date deserializeToDate (JsonElement json)
 

Private 属性

final DateFormat enUsFormat
 
final DateFormat localFormat
 
final DateFormat iso8601Format
 

详细描述

This type adapter supports three subclasses of date: Date, Timestamp, and java.sql.Date.

作者
Inderjeet Singh
Joel Leitch

构造及析构函数说明

com.google.gson.DefaultDateTypeAdapter.DefaultDateTypeAdapter ( )
inlinepackage
com.google.gson.DefaultDateTypeAdapter.DefaultDateTypeAdapter ( String  datePattern)
inlinepackage
com.google.gson.DefaultDateTypeAdapter.DefaultDateTypeAdapter ( int  style)
inlinepackage
com.google.gson.DefaultDateTypeAdapter.DefaultDateTypeAdapter ( int  dateStyle,
int  timeStyle 
)
inline
com.google.gson.DefaultDateTypeAdapter.DefaultDateTypeAdapter ( DateFormat  enUsFormat,
DateFormat  localFormat 
)
inlinepackage

成员函数说明

Date com.google.gson.DefaultDateTypeAdapter.deserialize ( JsonElement  json,
Type  typeOfT,
JsonDeserializationContext  context 
) throws JsonParseException
inline

Gson invokes this call-back method during deserialization when it encounters a field of the specified type.

In the implementation of this call-back method, you should consider invoking JsonDeserializationContext#deserialize(JsonElement, Type) method to create objects for any non-trivial field of the returned object. However, you should never invoke it on the the same type passing

json

since that will cause an infinite loop (Gson will call your call-back method again).

参数
jsonThe Json data being deserialized
typeOfTThe type of the Object to deserialize to
返回
a deserialized object of the specified type typeOfT which is a subclass of
T
异常
JsonParseExceptionif json is not in the expected format of
typeofT

实现了 com.google.gson.JsonDeserializer< T >.

Date com.google.gson.DefaultDateTypeAdapter.deserializeToDate ( JsonElement  json)
inlineprivate
JsonElement com.google.gson.DefaultDateTypeAdapter.serialize ( Date  src,
Type  typeOfSrc,
JsonSerializationContext  context 
)
inline
String com.google.gson.DefaultDateTypeAdapter.toString ( )
inline

类成员变量说明

final DateFormat com.google.gson.DefaultDateTypeAdapter.enUsFormat
private
final DateFormat com.google.gson.DefaultDateTypeAdapter.iso8601Format
private
final DateFormat com.google.gson.DefaultDateTypeAdapter.localFormat
private

该类的文档由以下文件生成: