Announcement Announcement Module
No announcement yet.
ProxyFactoryBean overrides equals() method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ProxyFactoryBean overrides equals() method

    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.

    public boolean equals&#40;Object arg0&#41; <-- correct but does not work
    public final boolean equals&#40;Object arg0&#41; <-- incorrect but works
    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.

    This is my Interceptor code which introduces the new interface:

    public interface Markable
        public MarkableStatus getMarkableStatus&#40;&#41;;
        public void setMarkableStatus&#40;MarkableStatus status&#41;;
    public class MarkableMixin extends DelegatingIntroductionInterceptor implements Markable
        private MarkableStatus markableStatus = MarkableStatus.DELETED;
        public MarkableStatus getMarkableStatus&#40;&#41;
            return this.markableStatus;
        public void setMarkableStatus&#40;MarkableStatus status&#41;
            this.markableStatus = status;
        public Object invoke&#40;MethodInvocation invocation&#41; throws Throwable
            // TODO&#58; implement thsi
            return super.invoke&#40;invocation&#41;;
    My Xml Configuration looks like this:

    <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 name="interceptorNames">
    		<property name="proxyTargetClass">
    	<bean id="roeTarget" class="com.archinsurance.integration.policy.archlink.impl.RiskObjectExposureImpl" />
    Any pointers in the right direction would be appreciated!