This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SerializerFeature.SkipTransientField support java.beans.Transient, is…
…sue #952
- Loading branch information
Showing
4 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.serializer.SerializerFeature; | ||
import junit.framework.TestCase; | ||
|
||
import java.beans.Transient; | ||
|
||
/** | ||
* Created by wenshao on 19/12/2016. | ||
*/ | ||
public class Issue952 extends TestCase { | ||
public void test_for_issue() throws Exception { | ||
Model model = new Model(); | ||
model.id = 1001; | ||
|
||
String text = JSON.toJSONString(model, SerializerFeature.SkipTransientField); | ||
|
||
assertEquals("{}", text); | ||
} | ||
|
||
public static class Model { | ||
private int id; | ||
|
||
@Transient | ||
public int getId() { | ||
return id; | ||
} | ||
} | ||
} |