Java classes that implement the Serializable interface

10,120

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.

Share:
10,120
Admin
Author by

Admin

Updated on July 13, 2022

Comments

  • Admin
    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
      Adam Paynter almost 15 years
      Would you be able to explain why you need this list?
    • brady
      brady almost 15 years
      The needle on my sounds-like-trouble meter just broke off.
    • jjnguy
      jjnguy almost 15 years
      Haha. Maybe he/she was just curious.
  • Cuga
    Cuga almost 15 years
    You can also use the Menu: Navigate > Quick Type Hierarchy.
  • Cuga
    Cuga almost 15 years
    Why 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
    Zsolt Török almost 15 years
    I 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
    Cuga almost 15 years
    I 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
    Jim Ferrans almost 15 years
    The 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
    Nat almost 15 years
    Serialization 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
    Nat almost 15 years
    Sorry for the typos: I wrote it on an iPhone.