java-web - Javabean 是否一定要实现Serializable接口?意义在哪?
巴扎黑
巴扎黑 2017-04-18 09:52:04
0
3
471

如题,以及是否javabean中无论public还是private都序列化还是怎么样?希望有有人来讨论下,或者给出相关文档的链接。
小弟谢过

巴扎黑
巴扎黑

reply all (3)
阿神

1.serializeable is a marked interface with no methods to be implemented. The purpose of this interface is to tell Java that developers allow this class to be serialized.
2. There is no specific test, but access modifiers such as public and private should not affect the serialization process.

Another:

I have previously written a blog article about Java serialization "Java Serialization Basics" which should be able to answer this question and introduce a simple way to call the Java serialization interface. The subject can test the access modifiers and Does serialization matter?

    Peter_Zhu

    Implements theSerializable是因为你需要使用JDK内置的序列化。
    以目前的技术来说是否实现Serializable接口已经不重要了,因为现在的序列化技术太多,都比JDK内置的要优秀,而且不需要实现Serializableinterface.
    EsotericSoftware/kryo
    msgpack
    FasterXML/jackson
    RuedigerMoeller/fast-serialization
    google/protobuf

      左手右手慢动作

      It does not have to be implemented, but some old systems still need it, such as some projects integrating backend and flex end, entities still need to be serialized

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!