fizzed / cloudhopper-smpp

Efficient, scalable, and flexible Java implementation of the Short Messaging Peer to Peer Protocol (SMPP)
Other
290 stars 130 forks source link

Add serialization support (while still keeping backwards compatibility) #8

Open aasaru opened 8 years ago

aasaru commented 8 years ago

I propose adding serialization support to PDU-s. I have tested it and it worked fine.

User can still break serialization by adding non-serializable object to a PDU using setReferenceObject(). It would be possible to change the method signature for this method so it would take only a serializable parameter but this would break backwards compatibility so I just added a comment.

The other way would be to deprecate current method and add new method, something like this: /* * @deprecated Replaced by {@link #setReference(Object)} / @Deprecated public void setReferenceObject(Object value) { this.referenceObject = value; }

public <T extends Serializable> void setReference(T value) {
    this.referenceObject = value;
}