Class TransformerFactory
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.weaving.TransformerFactory
-
public class TransformerFactory extends java.lang.ObjectThis class creates a ClassFileTransformer that is used for dynamic bytecode weaving. It is called byEntityManagerSetupImpl.predeploy(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)Note: The Session's Project is is scanned to ensure that weaving is supported and is modified to suit (set the
ObjectChangePolicyfor the Descriptor).
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCANNOT_WEAVE_CHANGETRACKINGstatic java.lang.StringCANNOT_WEAVE_VIRTUAL_ONE_TO_ONEprotected java.util.Map<java.lang.String,ClassDetails>classDetailsMapprotected java.lang.ClassLoaderclassLoaderprotected java.util.Collection<MetadataClass>entityClassesprotected org.eclipse.persistence.sessions.Sessionsessionprotected booleanweaveChangeTrackingprotected booleanweaveFetchGroupsprotected booleanweaveInternalprotected booleanweaveLazyprotected booleanweaveMappedSuperClassstatic java.lang.StringWEAVER_CLASS_NOT_IN_PROJECTstatic java.lang.StringWEAVER_DISABLE_BY_SYSPROPstatic java.lang.StringWEAVER_DISABLE_CT_NOT_SUPPORTEDstatic java.lang.StringWEAVER_FOUND_USER_IMPL_CTstatic java.lang.StringWEAVER_NULL_PROJECTstatic java.lang.StringWEAVER_PROCESSING_CLASSprotected booleanweaveRest
-
Constructor Summary
Constructors Constructor Description TransformerFactory(org.eclipse.persistence.sessions.Session session, java.util.Collection<MetadataClass> entityClasses, java.lang.ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClassDetailsForMappedSuperClasses(MetadataClass clz, org.eclipse.persistence.descriptors.ClassDescriptor initialDescriptor, ClassDetails classDetails, java.util.Map<java.lang.String,ClassDetails> classDetailsMap, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> unMappedAttributes, boolean weaveChangeTracking)INTERNAL: Look higher in the hierarchy for the mappings listed in the unMappedAttribute list.voidbuildClassDetailsAndModifyProject()Build a list ClassDetails instance that contains a ClassDetails for each class in our entities list.PersistenceWeaverbuildPersistenceWeaver()protected booleancanChangeTrackingBeEnabled(org.eclipse.persistence.descriptors.ClassDescriptor descriptor, MetadataClass clz, boolean globalWeaveChangeTracking)Check to ensure the class meets all the conditions necessary to enable change tracking This could occur either if the class already has change tracking implemented or if the class is capable of having change tracking woven based on the descriptor.protected booleancanWeaveValueHolders(MetadataClass clz, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> mappings)Determine if value holders are required to be weaved into the class.static PersistenceWeavercreateTransformerAndModifyProject(org.eclipse.persistence.sessions.Session session, java.util.Collection<MetadataClass> entityClasses, java.lang.ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass)protected org.eclipse.persistence.descriptors.ClassDescriptorfindDescriptor(org.eclipse.persistence.sessions.Project project, java.lang.String className)Find a descriptor by name in the given project used to avoid referring to descriptors by class.protected booleanhasFieldInClass(MetadataClass metadataClass, java.lang.String attributeName)Return if the class contains the field.protected voidlog(int level, java.lang.String msg, java.lang.Object[] params)protected java.util.List<org.eclipse.persistence.mappings.DatabaseMapping>storeAttributeMappings(MetadataClass metadataClass, ClassDetails classDetails, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> mappings, boolean weaveValueHolders)INTERNAL: Store a set of attribute mappings on the given ClassDetails that correspond to the given class.protected booleanwasChangeTrackingAlreadyWeaved(java.lang.Class<?> clz)
-
-
-
Field Detail
-
WEAVER_DISABLE_CT_NOT_SUPPORTED
public static final java.lang.String WEAVER_DISABLE_CT_NOT_SUPPORTED
- See Also:
- Constant Field Values
-
WEAVER_FOUND_USER_IMPL_CT
public static final java.lang.String WEAVER_FOUND_USER_IMPL_CT
- See Also:
- Constant Field Values
-
WEAVER_NULL_PROJECT
public static final java.lang.String WEAVER_NULL_PROJECT
- See Also:
- Constant Field Values
-
WEAVER_DISABLE_BY_SYSPROP
public static final java.lang.String WEAVER_DISABLE_BY_SYSPROP
- See Also:
- Constant Field Values
-
WEAVER_CLASS_NOT_IN_PROJECT
public static final java.lang.String WEAVER_CLASS_NOT_IN_PROJECT
- See Also:
- Constant Field Values
-
WEAVER_PROCESSING_CLASS
public static final java.lang.String WEAVER_PROCESSING_CLASS
- See Also:
- Constant Field Values
-
CANNOT_WEAVE_CHANGETRACKING
public static final java.lang.String CANNOT_WEAVE_CHANGETRACKING
- See Also:
- Constant Field Values
-
CANNOT_WEAVE_VIRTUAL_ONE_TO_ONE
public static final java.lang.String CANNOT_WEAVE_VIRTUAL_ONE_TO_ONE
- See Also:
- Constant Field Values
-
session
protected org.eclipse.persistence.sessions.Session session
-
entityClasses
protected java.util.Collection<MetadataClass> entityClasses
-
classDetailsMap
protected java.util.Map<java.lang.String,ClassDetails> classDetailsMap
-
classLoader
protected java.lang.ClassLoader classLoader
-
weaveChangeTracking
protected boolean weaveChangeTracking
-
weaveLazy
protected boolean weaveLazy
-
weaveFetchGroups
protected boolean weaveFetchGroups
-
weaveInternal
protected boolean weaveInternal
-
weaveRest
protected boolean weaveRest
-
weaveMappedSuperClass
protected boolean weaveMappedSuperClass
-
-
Constructor Detail
-
TransformerFactory
public TransformerFactory(org.eclipse.persistence.sessions.Session session, java.util.Collection<MetadataClass> entityClasses, java.lang.ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass)
-
-
Method Detail
-
createTransformerAndModifyProject
public static PersistenceWeaver createTransformerAndModifyProject(org.eclipse.persistence.sessions.Session session, java.util.Collection<MetadataClass> entityClasses, java.lang.ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass)
-
addClassDetailsForMappedSuperClasses
public void addClassDetailsForMappedSuperClasses(MetadataClass clz, org.eclipse.persistence.descriptors.ClassDescriptor initialDescriptor, ClassDetails classDetails, java.util.Map<java.lang.String,ClassDetails> classDetailsMap, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> unMappedAttributes, boolean weaveChangeTracking)
INTERNAL: Look higher in the hierarchy for the mappings listed in the unMappedAttribute list. We assume that if a mapping exists, the attribute must either be mapped from the owning class or from a superclass.
-
buildPersistenceWeaver
public PersistenceWeaver buildPersistenceWeaver()
-
buildClassDetailsAndModifyProject
public void buildClassDetailsAndModifyProject()
Build a list ClassDetails instance that contains a ClassDetails for each class in our entities list.
-
canChangeTrackingBeEnabled
protected boolean canChangeTrackingBeEnabled(org.eclipse.persistence.descriptors.ClassDescriptor descriptor, MetadataClass clz, boolean globalWeaveChangeTracking)Check to ensure the class meets all the conditions necessary to enable change tracking This could occur either if the class already has change tracking implemented or if the class is capable of having change tracking woven based on the descriptor.
-
wasChangeTrackingAlreadyWeaved
protected boolean wasChangeTrackingAlreadyWeaved(java.lang.Class<?> clz)
-
canWeaveValueHolders
protected boolean canWeaveValueHolders(MetadataClass clz, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> mappings)
Determine if value holders are required to be weaved into the class.
-
findDescriptor
protected org.eclipse.persistence.descriptors.ClassDescriptor findDescriptor(org.eclipse.persistence.sessions.Project project, java.lang.String className)Find a descriptor by name in the given project used to avoid referring to descriptors by class. This avoids having to construct a project by class facilitating weaving
-
hasFieldInClass
protected boolean hasFieldInClass(MetadataClass metadataClass, java.lang.String attributeName)
Return if the class contains the field.
-
storeAttributeMappings
protected java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> storeAttributeMappings(MetadataClass metadataClass, ClassDetails classDetails, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping> mappings, boolean weaveValueHolders)
INTERNAL: Store a set of attribute mappings on the given ClassDetails that correspond to the given class. Return the list of mappings that is not specifically found on the given class. These attributes will be found on MappedSuperclasses.
-
log
protected void log(int level, java.lang.String msg, java.lang.Object[] params)
-
-