Class ClassCopierOrdinaryImpl
java.lang.Object
org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierBase
org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl
- All Implemented Interfaces:
ClassCopier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate static classUse bridge to copy objects.private static classClass used as a factory for the appropriate Serialization constructors. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BridgeBridge is used to access unsafe methods used to read and write arbitrary data members in objects.private static Map<Class<?>, ClassCopierOrdinaryImpl.ClassFieldCopier> private static Map<Class<?>, Constructor<?>> private static final Packageprivate static final Packageprivate Constructor<?> private static ThreadLocal<Boolean> private MethodHandle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCopy(Object source) Create a copy of source.Do the copying of data from source to result.private static ClassCopierOrdinaryImpl.ClassFieldCopiergetClassFieldCopier(Class<?> cls, PipelineClassCopierFactory classCopierFactory) private static ClassCopierOrdinaryImpl.ClassFieldCopiergetSuperCopier(PipelineClassCopierFactory ccf, Class<?> cls) private static ClassCopierOrdinaryImpl.ClassFieldCopiermakeClassFieldCopierUnsafeCodegenImpl(Class<?> cls, PipelineClassCopierFactory classCopierFactory) Use bridge with code generated by codegen to copy objects.private Objectstatic voidsetCodegenCopierAllowed(boolean flag) private static booleanMethods inherited from class ClassCopierBase
copy, equals, hashCode, isReflectiveClassCopier, toString
-
Field Details
-
BRIDGE_REF
Bridge is used to access unsafe methods used to read and write arbitrary data members in objects. This is very fast, and completely ignores access protections including final on fields. NOTE WELL: Unsafe is capable of causing severe damage to the VM, including causing the VM to dump core. get and put calls must only be made with offsets obtained from objectFieldOffset calls. Because of the dangerous nature of Unsafe, its use must be carefully protected. -
classToClassFieldCopier
-
CODEGEN_SPI
-
CODEGEN_IMPL
-
isCodegenCopierAllowed
-
classToConstructor
-
classFieldCopier
-
constructor
-
readResolveMethod
-
-
Constructor Details
-
ClassCopierOrdinaryImpl
public ClassCopierOrdinaryImpl(PipelineClassCopierFactory ccf, Class<?> cls) throws ReflectiveCopyException - Throws:
ReflectiveCopyException
-
-
Method Details
-
resolve
-
useCodegenCopier
private static boolean useCodegenCopier() -
setCodegenCopierAllowed
public static void setCodegenCopierAllowed(boolean flag) -
getClassFieldCopier
private static ClassCopierOrdinaryImpl.ClassFieldCopier getClassFieldCopier(Class<?> cls, PipelineClassCopierFactory classCopierFactory) throws ReflectiveCopyException - Throws:
ReflectiveCopyException
-
getSuperCopier
private static ClassCopierOrdinaryImpl.ClassFieldCopier getSuperCopier(PipelineClassCopierFactory ccf, Class<?> cls) throws ReflectiveCopyException - Throws:
ReflectiveCopyException
-
makeClassFieldCopierUnsafeCodegenImpl
private static ClassCopierOrdinaryImpl.ClassFieldCopier makeClassFieldCopierUnsafeCodegenImpl(Class<?> cls, PipelineClassCopierFactory classCopierFactory) throws ReflectiveCopyException Use bridge with code generated by codegen to copy objects. This method must be invoked from inside a doPrivileged call.- Throws:
ReflectiveCopyException
-
createCopy
Description copied from class:ClassCopierBaseCreate a copy of source. The copy may or may not be fully initialized. This method must always be overridden in a subclass.- Specified by:
createCopyin classClassCopierBase- Throws:
ReflectiveCopyException
-
doCopy
public Object doCopy(Map<Object, Object> oldToNew, Object source, Object result) throws ReflectiveCopyExceptionDescription copied from class:ClassCopierBaseDo the copying of data from source to result. This just returns the result by default, but it may be overrideden in a subclass. When this method completes, result must be fully initialized.- Overrides:
doCopyin classClassCopierBase- Throws:
ReflectiveCopyException
-