Ouney
Ouney

Reputation: 1194

use of ObjectInputValidation in java

I have a question regarding ObjectInputValidation interface in java. This interface is used to validate graph after deserialization. My question is if one can validate the object in readObject method, then why should we use ObjectInputValidation?

Upvotes: 2

Views: 220

Answers (1)

Kristjan Veskimäe
Kristjan Veskimäe

Reputation: 992

Serialization can save object graphs and with ObjectInputValidation you can check the state of the entire graph, which is done when all the graph is restored.

Upvotes: 1

Related Questions