1、日期轉(zhuǎn)換默認(rèn)格式覆蓋注解格式的bug;

創(chuàng)新互聯(lián)成立與2013年,是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站建設(shè)、成都網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元南丹做網(wǎng)站,已為上家服務(wù),為南丹各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18982081108
com.alibaba.fastjson.serializer.JSONSerializer#writeWithFormat
修改后的代碼:
public final void writeWithFormat(Object object, String format) {
if (object instanceof Date) {
DateFormat dateFormat = this.getDateFormat();
if(format!=null){
dateFormat = new SimpleDateFormat(format, locale);
dateFormat.setTimeZone(timeZone);
}
String text = dateFormat.format((Date) object);
out.writeString(text);
return;
}
write(object);
}2、解決轉(zhuǎn)JSON時(shí)候Bean字段默認(rèn)被排序的毛病:
com.alibaba.fastjson.serializer.SerializeWriter#computeFeatures
修改的代碼:
protected void computeFeatures() {
quoteFieldNames = (this.features & SerializerFeature.QuoteFieldNames.mask) != 0;
useSingleQuotes = (this.features & SerializerFeature.UseSingleQuotes.mask) != 0;
// sortField = (this.features & SerializerFeature.SortField.mask) != 0;
sortField = false;
disableCircularReferenceDetect = (this.features & SerializerFeature.DisableCircularReferenceDetect.mask) != 0;
beanToArray = (this.features & SerializerFeature.BeanToArray.mask) != 0;
writeNonStringValueAsString = (this.features & SerializerFeature.WriteNonStringValueAsString.mask) != 0;
notWriteDefaultValue = (this.features & SerializerFeature.NotWriteDefaultValue.mask) != 0;
writeEnumUsingName = (this.features & SerializerFeature.WriteEnumUsingName.mask) != 0;
writeEnumUsingToString = (this.features & SerializerFeature.WriteEnumUsingToString.mask) != 0;
writeDirect = quoteFieldNames //
&& (this.features & nonDirectFeautres) == 0 //
&& (beanToArray || writeEnumUsingName)
;
keySeperator = useSingleQuotes ? '\'' : '"';
}
網(wǎng)站標(biāo)題:解決FastJson1.2.39的bug
文章路徑:http://www.chinadenli.net/article14/iiicde.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、微信公眾號(hào)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、品牌網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)