Java classes implementing the Serializable interface

I need a list of classes that implement Serializable. Could you also say which classes implement this interface?

+4
source share
5 answers

In the Java API, most classes implement Serializable ( here is the full list). Classes that must be serialized implement Serializable. You can use the IDE to find all the interface developers in your project.

+11
source

You can find a complete list of all performing classes here .

If you need to check programmatically, you can use the instanceof operator to check if the object is an instance of the Serializable interface.

The list of subinterfaces is not a list of all classes that actually implement the interface.

+2
source

If you use Eclipse, then anywhere you see "Serializable" (for example, in the class definition below):

 import java.io.Serializable; public Foo implements Serializable { } 
  • Click Serializable so the text marker is in the word
  • Hit Control + T

It will take a minute because it is such a common interface, but it will display all the classes that it can find in your path to the classes that implement Serializable .

+2
source

Implementing Serializable effectively makes classes and subclasses part of the public API. You can see at least some of the serializable classes by clicking the Serial Form link in the Javadoc output. Some of these classes are not public / protected as such (in the API docs they do not have references to the class documentation). Serializable anonymous inner classes are not displayed, although there are several fields this$0 .

0
source

Quick answer: any class you want to keep for later use.

This includes things like data wrappers (Integer, String, Character, etc.), data classes, and collections.

However, collections can be serialized if the elements in them are serializable.

In addition, there is a second Externalizable interface that is used by classes that write their data to some external interface, only with reference to the specified element stored in the serialization stream.

0
source

Source: https://habr.com/ru/post/1285683/


All Articles