jgp
jgp

Reputation: 2091

POJO library with GWT

I have a GWT project which is running fine and I use a bunch of shared classes. At this stage of the project, I need to share the POJOs with other library.

I decided to put the POJO in a library.

public class Application implements IsSerializable {
    // ....
}

As this library is technology neutral, i would like to get rid of the IsSerializable and the dependency to GWT. Does that make sense?

Do I need to do anything on the GWT side of the project?

Upvotes: 1

Views: 66

Answers (1)

Igor Klimer
Igor Klimer

Reputation: 15321

You can use the standard java.io.Serializable interface instead of the (now somewhat obsolete) IsSerializable. The reason it was introduced was to distinguish GWT RPC serialization from the Java's one. From the official FAQ entry on this subject:

  • The semantics of GWT's serialization are much less sophisticated than standard Java serialization, and so to use java.io.Serializable as the marker interface would imply that GWT's serialization system is capable of more than it actually is.
  • Conversely, GWT's serialization mechanism is simpler than standard Java's, and so to use java.io.Serializable would imply that users have more to worry about (such as serialization version IDs) than they actually do.
  • GWT implements only a subset of the full Java JRE classes, and specifically implements nothing in java.io. To use java.io.Serializable as the GWT RPC serialization marker interface dilutes the message that java.io is not usable within a GWT application.

While each of the points above still hold, the GWT Team felt that the community was generally aware of these issues but preferred the convenience of being able to use the standard java.io.Serializable interface rather than to have their classes implement the IsSerializable marker interface (...).

Upvotes: 1

Related Questions