I am introducing a new interface (Markable) to my object. In my object's implementation, I have overridden the .equals() method to do custom comparison.
However, after I inject the new interface into my class, the .equals() method gets overridden back to a default or some other implementation.
Also, please note, if i add the final keyword to my equals method, then the desired behavior occurs. However, this implies that I am using AOP, and I would prefer not to use the final keyword.
I am hoping to introduce a new interface via the ProxyFactoryBean but somehow turn off the .equals() automatic override. Also, if possible, I'd prefer to do this at the interface level rather than at the class level using CGLIB.Code:public boolean equals(Object arg0) <-- correct but does not work public final boolean equals(Object arg0) <-- incorrect but works
This is my Interceptor code which introduces the new interface:
My Xml Configuration looks like this:Code:public interface Markable { public MarkableStatus getMarkableStatus(); public void setMarkableStatus(MarkableStatus status); } public class MarkableMixin extends DelegatingIntroductionInterceptor implements Markable { private MarkableStatus markableStatus = MarkableStatus.DELETED; public MarkableStatus getMarkableStatus() { return this.markableStatus; } public void setMarkableStatus(MarkableStatus status) { this.markableStatus = status; } public Object invoke(MethodInvocation invocation) throws Throwable { // TODO: implement thsi return super.invoke(invocation); } }
Any pointers in the right direction would be appreciated!Code:<bean id="markableIntroductionAdvisor" class="com.archinsurance.integration.policy.archlink.impl.MarkableMixin"/> <bean id="roeProxy" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <ref local="roeTarget"/> </property> <property name="interceptorNames"> <list> <value>markableIntroductionAdvisor</value> </list> </property> <property name="proxyTargetClass"> <value>true</value> </property> </bean> <bean id="roeTarget" class="com.archinsurance.integration.policy.archlink.impl.RiskObjectExposureImpl" />
Thanks!
Adam


Reply With Quote