Not directly. Typically, serialization occurs when an object is written to ObjectOutputStream, but more often than not, it happens outside of your code (for example, in the libraries you use or in your container). So you have two options:
- . , , , , , . :
private void writeObject(java.io.ObjectOutputStream out) {
out.defaultWriteObject();
log.info("Object of type " +
getClass().getName() + " is being serialized");
}
, . (, ), Serializable. , , .