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 interface
private static class
Use bridge to copy objects.private static class
Class used as a factory for the appropriate Serialization constructors. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Bridge
Bridge 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 Package
private static final Package
private 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.ClassFieldCopier
getClassFieldCopier
(Class<?> cls, PipelineClassCopierFactory classCopierFactory) private static ClassCopierOrdinaryImpl.ClassFieldCopier
getSuperCopier
(PipelineClassCopierFactory ccf, Class<?> cls) private static ClassCopierOrdinaryImpl.ClassFieldCopier
makeClassFieldCopierUnsafeCodegenImpl
(Class<?> cls, PipelineClassCopierFactory classCopierFactory) Use bridge with code generated by codegen to copy objects.private Object
static void
setCodegenCopierAllowed
(boolean flag) private static boolean
Methods inherited from class org.glassfish.pfl.dynamic.copyobject.impl.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:ClassCopierBase
Create a copy of source. The copy may or may not be fully initialized. This method must always be overridden in a subclass.- Specified by:
createCopy
in classClassCopierBase
- Throws:
ReflectiveCopyException
-
doCopy
public Object doCopy(Map<Object, Object> oldToNew, Object source, Object result) throws ReflectiveCopyExceptionDescription copied from class:ClassCopierBase
Do 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:
doCopy
in classClassCopierBase
- Throws:
ReflectiveCopyException
-