com.alibaba.fastjson.serializer.SimpleDateFormatSerializer Java Examples

The following examples show how to use com.alibaba.fastjson.serializer.SimpleDateFormatSerializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Json.java    From talent-aio with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 设置java.util.Date和java.sql.Date的格式(用于fastjson)
 * @param format
 */
public static void setDateFormat(String format)
{
	mapping.put(Date.class, new SimpleDateFormatSerializer(format));
	mapping.put(java.sql.Date.class, new SimpleDateFormatSerializer(format));
}
 
Example #2
Source File: Json.java    From talent-aio with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 设置java.sql.Time的格式(用于fastjson)
 * @param format
 */
public static void setTimeFormat(String format)
{
	mapping.put(java.sql.Time.class, new SimpleDateFormatSerializer(format));
}
 
Example #3
Source File: Json.java    From talent-aio with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 设置java.sql.Timestamp的格式(用于fastjson)
 * @param format
 */
public static void setTimestampFormat(String format)
{
	mapping.put(java.sql.Timestamp.class, new SimpleDateFormatSerializer(format));
}
 
Example #4
Source File: JsonSeriaziler.java    From easyooo-framework with Apache License 2.0 4 votes vote down vote up
public JsonSeriaziler(String dateFormat){
	features[features.length] = SerializerFeature.WriteDateUseDateFormat;
	mapping.put(java.util.Date.class, new SimpleDateFormatSerializer(dateFormat));
}