Java classes that implement the Serializable interface
Solution 1
In the Java API, most of the classes implement Serializable (here is a full list). Classes that need to be serialized implement Serializable. You can use an IDE to find all implementors of an interface in your project.
Solution 2
If you use Eclipse, then in any place you see "Serializable" (such as in the class definition below):
import java.io.Serializable;
public Foo implements Serializable {
}
- Click on
Serializable
so that the text marker is in the word - Hit Control + T
It should take a minute because this is such a prevalent interface, but it will display all the classes it can find on your classpath which implement Serializable
.
Solution 3
You can find a full list of all implementing classes Here.
If you need to check programatically, you can use the instanceof
operator to check to see if an object is an instance of the Serializable
interface.
The list of subinterfaces is not a list of all classes that actually implement the interface.
Admin
Updated on July 13, 2022Comments
-
Admin almost 2 years
I need a list of classes that implement Serializable. Could you also tell me what kind of classes implement that interface?
-
Adam Paynter almost 15 yearsWould you be able to explain why you need this list?
-
brady almost 15 yearsThe needle on my sounds-like-trouble meter just broke off.
-
jjnguy almost 15 yearsHaha. Maybe he/she was just curious.
-
-
Cuga almost 15 yearsYou can also use the Menu: Navigate > Quick Type Hierarchy.
-
Cuga almost 15 yearsWhy would you vote this down? It gives a full list of all the classes on your classpath that implement Serializable, and this is a much more comprehensive list than the ones given above.
-
Zsolt Török almost 15 yearsI guess you got the downvotes because you suggested making a class just for the sake of being able to select the Serializable interface. I would suggest accessing the interface by hitting Ctrl + Shift + T, and typing Serializable into the filter box. After that, you can either hit the above mentioned Ctrl + T to get the class hierarchy in a floating widget, or F4 to get it in a separate view.
-
Cuga almost 15 yearsI see what you mean. I didn't intend to imply this was the only way to open the type hierarchy-- I wanted it to be easy and clear to see how it can done.
-
Jim Ferrans almost 15 yearsThe original question was for "a list of classes that implement Serializable". What list? Serializables in the JDK? Serializables in a large mess of code you've just inherited? Either interpretation is reasonable, and learning how to look up the information in both situations is helpful.
-
Nat almost 15 yearsSerialization is not for long-term storage. Only for short-term uses such as communication. Classes that implement Externalizable do store their externalised state in the serialization stream. The difference between serialisabke and exrernalisable classes is that the serialiser is responsible for the stream format of serialisable classes but externalisable classes implement their own format.
-
Nat almost 15 yearsSorry for the typos: I wrote it on an iPhone.