Announcement Announcement Module
Collapse
No announcement yet.
Behavior of proxying concrete classes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Behavior of proxying concrete classes

    Code:
      
      ProxyFactory pf = new ProxyFactory();
      pf.addAdvice((MyInterceptor) ClassFactory.getInstance().getObjectById("myInterceptor"));
      pf.setTarget(concreteObject);
      ObjectIF returnObject = (ObjectIF) pf.getProxy();
    We're using this method, because we want to be able in some cases to:
    Code:
      ConcreteBase base = (ConcreteBase) returnObject;
    The odd behavior is that when we call base.doSomeOp() if that method directly accesses a member, it uses the value from the proxy, not the original object (set through an arg-based ctor). It accesses the correct value only if we put a getter in front of the member variable.

    Is this the correct behavior?
    Is something else weird going on?
    Any other insights?
Working...
X