Re: [問題] JAVA技巧 (the transient Keyword)
※ 引述《jackyhuang (雪.狼.湖)》之銘言:
: ※ 引述《feicsh.bbs@bbs.wretch.cc (飛)》之銘言:
: : 設不設成private也不是solution, 請參考我的前文。
: 這個和transient關鍵字有關,不過一般很少人會用到這個就是了。
: serialization的東西其實很複雜,當其內容牽扯到繼承,deep/shallow copy..etc
: 不是三言二語可以交待得清楚 (雖然大多數的人可以不理會細節去使用)
: 我建議想要對其內容多瞭解的人可以閱讀 O'Reilly Java I/O一書
: 有一個chapter專門在討論這個主題 (用了一個chapter就知道他不會太單純了)
: 不想知道細節的人我也建議看一下會有什麼issue,以免在不小心的情況下誤用...
haha, 找了一下教學網頁
URL:
http://java.sun.com/products/javabeans/docs/
javaBeansTutorial-Nov97/javabeans/simplebean/persistence.html
(http://0rz.net/1b1s0)
<%
Selective Serialization Using the transient Keyword
To exclude fields from serialization in a Serializable object from
serialization, mark the fields with the transient modifier.
transient int Status;
Default serialization will not serialize transient and static fields.
%>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.26.34.105
java 近期熱門文章
PTT數位生活區 即時熱門文章