Reputation: 3462
I couldn't figure out if this change in the constructor is still (de)serialization compatible in Java Object Serialization. These classes are used as http-session objects.
Current code
import com.foo.FooDataObject;
public class Foo extends FooBase {
public Foo(final FooDataObject fooDataObject) {
super(fooDataObject.getFoo);
}
}
public abstract class FooBase implements Serializable {
private final String foo;
public FooBase(final String foo) {
this.foo = foo;
}
public String getFoo() {
return foo;
}
}
Change (the class of the constructor parameter changed):
import com.foo.wherever.FooDO;
public class Foo extends FooBase {
public Foo(final FooDO fooDO) {
super(fooDO.getFoo);
}
}
Upvotes: 0
Views: 163
Reputation: 1767
Yes, it should be. You are simply changing the type of the parameter, but still using the same way of instance construction - via constructor with arguments.
See more of the available ways for Jackson deserialization (if you use this framework) here.
Upvotes: 1