Module org.eclipse.persistence.jpa
Class TransformerFactory
java.lang.Object
org.eclipse.persistence.internal.jpa.weaving.TransformerFactory
This class creates a ClassFileTransformer that is used for dynamic bytecode
weaving. It is called by
EntityManagerSetupImpl.predeploy(jakarta.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 ObjectChangePolicy
for the Descriptor).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Map<String, ClassDetails> protected ClassLoaderprotected Collection<MetadataClass> protected Sessionprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionTransformerFactory(Session session, Collection<MetadataClass> entityClasses, ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassDetailsForMappedSuperClasses(MetadataClass clz, ClassDescriptor initialDescriptor, ClassDetails classDetails, Map<String, ClassDetails> classDetailsMap, List<DatabaseMapping> unMappedAttributes, boolean weaveChangeTracking) INTERNAL: Look higher in the hierarchy for the mappings listed in the unMappedAttribute list.voidBuild a list ClassDetails instance that contains a ClassDetails for each class in our entities list.protected booleancanChangeTrackingBeEnabled(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, List<DatabaseMapping> mappings) Determine if value holders are required to be weaved into the class.static PersistenceWeavercreateTransformerAndModifyProject(Session session, Collection<MetadataClass> entityClasses, ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass) protected ClassDescriptorfindDescriptor(Project project, String className) Find a descriptor by name in the given project used to avoid referring to descriptors by class.protected booleanhasFieldInClass(MetadataClass metadataClass, String attributeName) Return if the class contains the field.protected voidprotected List<DatabaseMapping> storeAttributeMappings(MetadataClass metadataClass, ClassDetails classDetails, List<DatabaseMapping> mappings, boolean weaveValueHolders) INTERNAL: Store a set of attribute mappings on the given ClassDetails that correspond to the given class.protected booleanwasChangeTrackingAlreadyWeaved(Class<?> clz)
-
Field Details
-
WEAVER_DISABLE_CT_NOT_SUPPORTED
- See Also:
-
WEAVER_FOUND_USER_IMPL_CT
- See Also:
-
WEAVER_NULL_PROJECT
- See Also:
-
WEAVER_DISABLE_BY_SYSPROP
- See Also:
-
WEAVER_CLASS_NOT_IN_PROJECT
- See Also:
-
WEAVER_PROCESSING_CLASS
- See Also:
-
CANNOT_WEAVE_CHANGETRACKING
- See Also:
-
CANNOT_WEAVE_VIRTUAL_ONE_TO_ONE
- See Also:
-
session
-
entityClasses
-
classDetailsMap
-
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 Details
-
TransformerFactory
public TransformerFactory(Session session, Collection<MetadataClass> entityClasses, ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass)
-
-
Method Details
-
createTransformerAndModifyProject
public static PersistenceWeaver createTransformerAndModifyProject(Session session, Collection<MetadataClass> entityClasses, ClassLoader classLoader, boolean weaveLazy, boolean weaveChangeTracking, boolean weaveFetchGroups, boolean weaveInternal, boolean weaveRest, boolean weaveMappedSuperClass) -
addClassDetailsForMappedSuperClasses
public void addClassDetailsForMappedSuperClasses(MetadataClass clz, ClassDescriptor initialDescriptor, ClassDetails classDetails, Map<String, ClassDetails> classDetailsMap, List<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
-
buildClassDetailsAndModifyProject
public void buildClassDetailsAndModifyProject()Build a list ClassDetails instance that contains a ClassDetails for each class in our entities list. -
canChangeTrackingBeEnabled
protected boolean canChangeTrackingBeEnabled(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
-
canWeaveValueHolders
Determine if value holders are required to be weaved into the class. -
findDescriptor
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
Return if the class contains the field. -
storeAttributeMappings
protected List<DatabaseMapping> storeAttributeMappings(MetadataClass metadataClass, ClassDetails classDetails, List<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
-