public class DeepCloneHelper extends java.lang.Object implements java.util.function.Function<LazyRelationMap,java.lang.Boolean>, BOSerializationDepthI
BO.doExWriteLRMFunction to control if manyrelations
should be deepCloned when frapFromCache'ing a BO.
Allows to limit it by a maximum (overall) depth and number of BOs in a manyrelation.
Does not support multithreading when counting, because the expected usage is inside a ThreadLocal, i.e. single threaded.$0| Constructor and Description |
|---|
DeepCloneHelper()
Default constructor.
|
DeepCloneHelper(int maxDepth,
int sizeLimit) |
DeepCloneHelper(int maxDepth,
int sizeLimit,
boolean clearFailedUnlazies) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Boolean |
apply(LazyRelationMap lrm)
Will be called BEFORE entering the n-m relation, i.e. we are asked if we want to increase nmDepth by 1
|
java.lang.String |
getCurrentPath() |
int |
getDepth()
The sum of n-1 and n-m relations, i.e. the current effective depth
|
int |
getN1Depth()
Current depth just regarding n-1 relations
|
int |
getNMDepth()
Current depth just regarding n-m relations
|
void |
popN1()
Decreses the n-1 relation counter and pops the last object from the depth stack
|
void |
popNM()
Decreses the n-1 relation counter and pops the last object from the depth stack
|
void |
pushN1(BOI o)
Increases the n-1 relation counter and adds this (nullable) BO to the stack.
|
void |
pushNM(java.util.Map map)
Increases the n-m relation counter and adds this nonnull LazyMap to the depth stack
|
void |
reset()
Resets all counters back to 0 and clears the current path
|
static <T> T |
withUnlazyManyrelations(DeepCloneHelper helper,
java.util.function.Supplier<T> supplier)
Method to wrap a frapFromCache call inside a provided DeepCloneHelper to handle cloning of unlazy maps and
correctly removing the used ThreadLocal again.
|
static <T> T |
withUnlazyManyrelations(int maxDepth,
int sizeLimit,
java.util.function.Supplier<T> supplier) |
static <T> T |
withUnlazyManyrelations(java.util.function.Supplier<T> supplier) |
public DeepCloneHelper()
public DeepCloneHelper(int maxDepth,
int sizeLimit)
public DeepCloneHelper(int maxDepth,
int sizeLimit,
boolean clearFailedUnlazies)
public void reset()
BOSerializationDepthIreset in interface BOSerializationDepthIpublic void pushN1(BOI o)
BOSerializationDepthIBOSerializationDepthI.popN1()pushN1 in interface BOSerializationDepthIpublic void popN1()
BOSerializationDepthIpopN1 in interface BOSerializationDepthIpublic void pushNM(java.util.Map map)
BOSerializationDepthIpushNM in interface BOSerializationDepthIpublic void popNM()
BOSerializationDepthIpopNM in interface BOSerializationDepthIpublic int getN1Depth()
BOSerializationDepthIgetN1Depth in interface BOSerializationDepthIpublic int getNMDepth()
BOSerializationDepthIgetNMDepth in interface BOSerializationDepthIpublic int getDepth()
BOSerializationDepthIgetDepth in interface BOSerializationDepthIpublic java.lang.Boolean apply(LazyRelationMap lrm)
apply in interface java.util.function.Function<LazyRelationMap,java.lang.Boolean>public java.lang.String getCurrentPath()
public static <T> T withUnlazyManyrelations(java.util.function.Supplier<T> supplier)
public static <T> T withUnlazyManyrelations(int maxDepth,
int sizeLimit,
java.util.function.Supplier<T> supplier)
public static <T> T withUnlazyManyrelations(DeepCloneHelper helper, java.util.function.Supplier<T> supplier)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.