Class ObjectDeepCopyUtility
java.lang.Object
com.broadleafcommerce.catalog.service.util.ObjectDeepCopyUtility
Utility for performing deep clones of objects using
Kryo.
It is thread-safe and utilizes a Pool to manage expensive Kryo instances.
- Since:
- Catalog Service 2.3.0, Release Train 2.3.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.esotericsoftware.kryo.kryo5.Kryo<T> TdeepClone(T source) Performs a deep clone of the source object.protected voidregisterCurrencyUnitSerializer(com.esotericsoftware.kryo.kryo5.Kryo kryo) protected voidregisterMonetaryAmountSerializer(com.esotericsoftware.kryo.kryo5.Kryo kryo)
-
Constructor Details
-
ObjectDeepCopyUtility
-
-
Method Details
-
constructKryoInstance
protected com.esotericsoftware.kryo.kryo5.Kryo constructKryoInstance() -
registerMonetaryAmountSerializer
protected void registerMonetaryAmountSerializer(com.esotericsoftware.kryo.kryo5.Kryo kryo) -
registerCurrencyUnitSerializer
protected void registerCurrencyUnitSerializer(com.esotericsoftware.kryo.kryo5.Kryo kryo) -
deepClone
@Nullable public <T> T deepClone(@Nullable T source) Performs a deep clone of the source object.This method is thread-safe. It borrows a Kryo instance from the internal pool, performs the copy, and returns the instance to the pool.
- Type Parameters:
T- the type of the object- Parameters:
source- the object to clone- Returns:
- a deep copy of the source, or null if source is null
-