Effective Java



Download 2,19 Mb.
Pdf ko'rish
bet327/341
Sana11.07.2022
Hajmi2,19 Mb.
#776765
1   ...   323   324   325   326   327   328   329   330   ...   341
Bog'liq
Effective Java



CHAPTER 12
SERIALIZATION
366
The serialization proxy pattern has two limitations. It is not compatible with
classes that are extendable by their users (Item 19). Also, it is not compatible with
some classes whose object graphs contain circularities: if you attempt to invoke a
method on such an object from within its serialization proxy’s 
readResolve
method, you’ll get a 
ClassCastException
because you don’t have the object yet,
only its serialization proxy.
Finally, the added power and safety of the serialization proxy pattern are not
free. On my machine, it is 14 percent more expensive to serialize and deserialize
Period
instances with serialization proxies than it is with defensive copying.
In summary, consider the serialization proxy pattern whenever you find
yourself having to write a 
readObject
or 
writeObject
method on a class that is
not extendable by its clients. This pattern is perhaps the easiest way to robustly
serialize objects with nontrivial invariants.


367
A P P E N D I X
Items Corresponding to Second Edition

Download 2,19 Mb.

Do'stlaringiz bilan baham:
1   ...   323   324   325   326   327   328   329   330   ...   341




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish