Class ClassCopierFactoryPipelineImpl
java.lang.Object
org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierFactoryPipelineImpl
- All Implemented Interfaces:
ClassCopierFactory
,PipelineClassCopierFactory
A factory used for creating ClassCopier instances.
An instance of this factory can be created and customized to
handle special copying semantics for certain classes.
This maintains a cache of ClassCopiers, so that a ClassCopier is
never created more than once for a particular class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassCopierFactory
private ClassCopier
private CachingClassCopierFactory
private static final Class<?>[]
private static final Class<?>[]
private static final Class<?>[]
private ClassCopierFactory
private ReentrantReadWriteLock
private ClassCopierFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClassCopier
(Class<?> cls) Analyze cls to determine the appropriate ClassCopier and return the ClassCopier instance.lookupInCache
(Class<?> cls) Look for cls only in the cache; do not create a ClassCopier if there isn't one already in the cache.boolean
reflectivelyCopyable
(Class<?> cls) Added this method so reflective copier could check if serializable object contains a transient field of specific type.final void
registerImmutable
(Class<?> cls) Register an immutable class, so that it will not be copied, but just passed by reference.void
Set a special ClassCopierFactory to handle some application specific needs.
-
Field Details
-
notCopyable
-
immutable
-
mapClasses
-
factoryCache
-
specialFactory
-
arrayFactory
-
ordinaryFactory
-
errorCopier
-
rwlock
-
-
Constructor Details
-
ClassCopierFactoryPipelineImpl
public ClassCopierFactoryPipelineImpl()
-
-
Method Details
-
reflectivelyCopyable
Description copied from interface:PipelineClassCopierFactory
Added this method so reflective copier could check if serializable object contains a transient field of specific type.- Specified by:
reflectivelyCopyable
in interfacePipelineClassCopierFactory
-
lookupInCache
Look for cls only in the cache; do not create a ClassCopier if there isn't one already in the cache.- Specified by:
lookupInCache
in interfacePipelineClassCopierFactory
-
registerImmutable
Register an immutable class, so that it will not be copied, but just passed by reference.- Specified by:
registerImmutable
in interfacePipelineClassCopierFactory
-
setSpecialClassCopierFactory
Set a special ClassCopierFactory to handle some application specific needs.- Specified by:
setSpecialClassCopierFactory
in interfacePipelineClassCopierFactory
-
getClassCopier
Analyze cls to determine the appropriate ClassCopier and return the ClassCopier instance. Will only create a ClassCopier for a given Class once.- Specified by:
getClassCopier
in interfaceClassCopierFactory
- Throws:
ReflectiveCopyException
-