Class EntityMarkerClassTransformer
java.lang.Object
org.broadleafcommerce.common.extensibility.jpa.copy.AbstractClassTransformer
org.broadleafcommerce.common.extensibility.jpa.convert.EntityMarkerClassTransformer
- All Implemented Interfaces:
jakarta.persistence.spi.ClassTransformer,BroadleafClassTransformer,org.springframework.beans.factory.InitializingBean
public class EntityMarkerClassTransformer
extends AbstractClassTransformer
implements BroadleafClassTransformer
This class transformer will check to see if there is class that should have been loaded by the MergePersistenceUnitManager
(meaning, it has an @Entity, @MappedSuperclass or @Embeddable annotation on it and will be inside of a persistence.xml).
If it it should have, it will add the fully qualified classname of that class to the transformedClassNames list.
This is a validation check to ensure that the class transformers are actually working properly
- Author:
- Andre Azzolini (apazzolini)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<DirectCopyIgnorePattern>protected static final org.apache.commons.logging.LogFields inherited from class org.broadleafcommerce.common.extensibility.jpa.copy.AbstractClassTransformer
alreadyLoadedClasses, preLoadClassNamePatterns -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcompileJPAProperties(Properties props, Object key) protected booleancontainsTypeLevelPersistenceAnnotation(javassist.bytecode.annotation.Annotation[] annotations) Determines if a given annotation set contains annotations that correspond to ones that someone would expect to appear in a persistence.xmlprotected booleanvoidsetIgnorePatterns(List<DirectCopyIgnorePattern> ignorePatterns) byte[]transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) Methods inherited from class org.broadleafcommerce.common.extensibility.jpa.copy.AbstractClassTransformer
afterPropertiesSet, setPreLoadClassNamePatterns
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOG -
transformedEntityClassNames
-
transformedNonEntityClassNames
-
ignorePatterns
-
-
Constructor Details
-
EntityMarkerClassTransformer
public EntityMarkerClassTransformer()
-
-
Method Details
-
transform
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws jakarta.persistence.spi.TransformerException - Specified by:
transformin interfacejakarta.persistence.spi.ClassTransformer- Throws:
jakarta.persistence.spi.TransformerException
-
containsTypeLevelPersistenceAnnotation
protected boolean containsTypeLevelPersistenceAnnotation(javassist.bytecode.annotation.Annotation[] annotations) Determines if a given annotation set contains annotations that correspond to ones that someone would expect to appear in a persistence.xml- Parameters:
annotations-- Returns:
-
isIgnored
-
compileJPAProperties
- Specified by:
compileJPAPropertiesin interfaceBroadleafClassTransformer- Throws:
Exception
-
getTransformedEntityClassNames
- Returns:
- a list of fully qualified classnames of class that have an @Entity, @MappedSuperclass or @Embeddable annotation and were picked up by this class transformer (meaning that other class transformers also would have had a chance to perform their necessary work on those classes)
-
getTransformedNonEntityClassNames
- Returns:
- a list of fully qualified classnames of classes that do not have an @Entity, @MappedSuperclass or @Embeddable
annotation but were picked up by this class transformer. This usually results in a benign misconfiguration as there are
unnecessary classes within the
MergePersistenceUnitManager
-
getIgnorePatterns
-
setIgnorePatterns
-