Class RemoveCacheClassTransformer
java.lang.Object
org.broadleafcommerce.common.extensibility.jpa.copy.AbstractClassTransformer
org.broadleafcommerce.common.extensibility.jpa.cache.RemoveCacheClassTransformer
- All Implemented Interfaces:
jakarta.persistence.spi.ClassTransformer,BroadleafClassTransformer,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.InitializingBean
public class RemoveCacheClassTransformer
extends AbstractClassTransformer
implements BroadleafClassTransformer, org.springframework.beans.factory.BeanFactoryAware
Strip the cache annotation from classes and the class fields
Example configuration
@Merge("blMergedClassTransformers")
public RemoveCacheClassTransformer RemoveProductCache() {
RemoveCacheClassTransformer transformer = new RemoveCacheClassTransformer("Remove Product Cache");
List<String> cacheRegions = new ArrayList<>();
cacheRegions.add("blCustomerElements");
cacheRegions.add("blOrderElements");
transformer.setCacheRegions(cacheRegions);
return transformer;
}
This feature requires that the property "remove.order.customer.entity.l2cache" be enabled (true).
- Author:
- Jeff Fischer, Daniel Colgrove
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.springframework.beans.factory.config.ConfigurableBeanFactoryprotected Stringprotected BooleanFields inherited from class org.broadleafcommerce.common.extensibility.jpa.copy.AbstractClassTransformer
alreadyLoadedClasses, preLoadClassNamePatterns -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BooleanannotationQualifies(javassist.bytecode.ConstPool constantPool, List<?> attributes) protected BooleancacheRegionQualifies(javassist.bytecode.annotation.Annotation annotation) protected BooleanclassQualifies(String className) voidcompileJPAProperties(Properties props, Object key) The fully-qualified classname of the annotation to remove at the class and field levelThe list of cache region names to be removed by this transformerThe list of fully-qualified classes to be impacted by this transformerprotected BooleanisPropertyEnabled(String propertyName) voidsetAnnotationClass(String annotationClass) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetCacheRegions(List<String> cacheRegions) voidsetClassNames(List<String> classNames) protected javassist.bytecode.AnnotationsAttributestripAnnotation(javassist.bytecode.ConstPool constantPool, List<?> attributes) 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
-
moduleName
-
classNames
-
cacheRegions
-
annotationClass
-
beanFactory
protected org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory -
removeOrderCustomerEntityL2Cache
@Value("${remove.order.customer.entity.l2cache:false}") protected Boolean removeOrderCustomerEntityL2Cache
-
-
Constructor Details
-
RemoveCacheClassTransformer
-
-
Method Details
-
compileJPAProperties
- Specified by:
compileJPAPropertiesin interfaceBroadleafClassTransformer- Throws:
Exception
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
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
-
classQualifies
-
annotationQualifies
-
cacheRegionQualifies
-
stripAnnotation
protected javassist.bytecode.AnnotationsAttribute stripAnnotation(javassist.bytecode.ConstPool constantPool, List<?> attributes) -
isPropertyEnabled
-
getClassNames
The list of fully-qualified classes to be impacted by this transformer- Returns:
-
setClassNames
-
getCacheRegions
The list of cache region names to be removed by this transformer- Returns:
-
setCacheRegions
-
getAnnotationClass
The fully-qualified classname of the annotation to remove at the class and field level- Returns:
-
setAnnotationClass
-