Class SerializationUtils
java.lang.Object
com.baomidou.mybatisplus.core.toolkit.SerializationUtils
copy from spring-core#org.springframework.util.SerializationUtils version 5.2.8
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Serializable>
Tclone(T object) Deep clone anObjectusing serialization.static Objectdeserialize(byte[] bytes) Deserialize the byte array into an object.static byte[]Serialize the given object to a byte array.
-
Constructor Details
-
SerializationUtils
public SerializationUtils()
-
-
Method Details
-
clone
Deep clone anObjectusing serialization.This is many times slower than writing clone methods by hand on all objects in your object graph. However, for complex object graphs, or for those that don't support deep cloning this can be a simple alternative implementation. Of course all the objects must be
Serializable.- Type Parameters:
T- the type of the object involved- Parameters:
object- theSerializableobject to clone- Returns:
- the cloned object
-
serialize
Serialize the given object to a byte array.- Parameters:
object- the object to serialize- Returns:
- an array of bytes representing the object in a portable fashion
-
deserialize
Deserialize the byte array into an object.- Parameters:
bytes- a serialized object- Returns:
- the result of deserializing the bytes
-