public abstract class AbstractCopier<A> extends Object implements Copier
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCopier() |
protected |
AbstractCopier(Set<Class<?>> immutableClasses,
Map<Class<?>,Function<Object,Object>> deepCopyStrategies) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canDeeplyCopy(Class<?> clazz)
Returns if the class has a known deep copy strategy.
|
<T> T |
copy(T object,
ClassLoader classLoader)
Returns a deep copy of the object.
|
protected abstract Object |
deserialize(A data,
ClassLoader classLoader)
Deserializes the data using the provided classloader.
|
protected boolean |
isImmutable(Class<?> clazz)
Returns if the class is an immutable type and does not need to be copied.
|
static Map<Class<?>,Function<Object,Object>> |
javaDeepCopyStrategies() |
static Set<Class<?>> |
javaImmutableClasses() |
protected <T> T |
roundtrip(T object,
ClassLoader classLoader)
Performs the serialization and deserialization, returning the copied object.
|
protected abstract A |
serialize(Object object)
Serializes the object.
|
public static Set<Class<?>> javaImmutableClasses()
public static Map<Class<?>,Function<Object,Object>> javaDeepCopyStrategies()
public <T> T copy(T object,
ClassLoader classLoader)
Copierprotected boolean isImmutable(Class<?> clazz)
clazz - the class of the object being copiedprotected boolean canDeeplyCopy(Class<?> clazz)
clazz - the class of the object being copiedprotected <T> T roundtrip(T object,
ClassLoader classLoader)
T - the type of object being copiedobject - the object to serializeclassLoader - the classloader to create the instance withprotected abstract A serialize(Object object)
object - the object to serializeprotected abstract Object deserialize(A data, ClassLoader classLoader)
data - the serialized bytesclassLoader - the classloader to create the instance with