Interface NativeMethodEntityExtensionHandler<T>
- All Superinterfaces:
ExtensionHandler
Extension handler used for contributions to native Object methods on entity like equals() clone() and hashCode(). It is possible that dynamically weaved in columns from embeddables need to contribute to those methods.
Managers that implement this handler should add themselves to the blEntityExtensionManagers
list:
<bean id="myEntityExtensionManagers" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="blSomeEntityExtensionManager" value-ref="blSomeEntityExtensionManager"/>
</map>
</property>
</bean>
<bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
<property name="collectionRef" value="myEntityExtensionManagers"/>
<property name="targetRef" value="blEntityExtensionManagers"/>
</bean>
These blEntityExtensionManagers
are added onto the BroadleafRequestContext
with
BroadleafRequestContext.getAdditionalProperties()
. Native methods can use that to pull it off
Example use case is in SiteImpl.clone()
as well as CategoryImpl#getAllChildCategoryXrefs()
- Author:
- Phillip Verheyden (phillipuniverse)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contributeClone
(T from, T to) Contributes additional properties to a cloned instance.void
contributeEquals
(T original, T test, ExtensionResultHolder<Boolean> result) Contributes additional equals() checks.void
contributeHashCode
(T entity, int precomputedHashCode, ExtensionResultHolder<Integer> result) Contributes more properties to build an object's hashCode().Methods inherited from interface org.broadleafcommerce.common.extension.ExtensionHandler
getPriority, isEnabled
-
Method Details
-
contributeClone
Contributes additional properties to a cloned instance. Implementors should take properties from from and copy them over to to- Parameters:
from
- the original instance that is being clonedto
- the instance that from is being cloned to
-
contributeEquals
Contributes additional equals() checks. Dynamically weaved properties should check between original and test and store the result in result.- Parameters:
original
- the instance being checked for equals (the 'this' side of equals)test
- the instance being compared to original for equalityresult
- where the result should be stored if this extension manager
-
contributeHashCode
Contributes more properties to build an object's hashCode().- Parameters:
entity
- the entity whose hashCode is being computedprecomputedHashCode
- the hashCode precomputed from the existing properties on entityresult
- where the final hashCode() should be stored
-