Name
ObjectInputValidation
Synopsis
A class implements this interface and
defines the validateObject(
)
method in order to validate itself when
it and all the objects it depends on have been completely
deserialized from an ObjectInputStream. The
validateObject( ) method is only invoked, however,
if the object is passed to
ObjectInputStream.registerValidation(
)
; this must be done from the
readObject( )
method of the object. Note that if an object is deserialized as part
of a larger object graph, its validateObject( )
method is not invoked until the entire graph is read, and the
original call to ObjectInputStream.readObject( )
is about to return. validateObject( ) should throw
an
InvalidObjectException
if the object fails validation. This stops object serialization, and
the original call to ObjectInputStream.readObject(
) terminates with the
InvalidObjectException exception.
public interface ObjectInputValidation { // Public Instance Methods void validateObject( ) throws InvalidObjectException; }
Passed To
ObjectInputStream.registerValidation( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access