Announcement Announcement Module
No announcement yet.
Can i change a proxy to point at a differnt target at runtime ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by sudheerk84 View Post
    I have a use case as follows

    Entity ent = new Entity();

    Entity has methods - setAAA(), setBBB(), ....

    Service A - calls getEntity() - which returns entity object.

    When service A calls getEntity().setAAA() - i want to intercept this method and return a new entity object.

    So i am think of creating a proxy inside getEntity() - and return a proxy.

    When i intercept setAAA() - method i want to craete new Entity object and point make teh proxy to pint at this new Entity().

    Is this possible ?

    I am planning to use Proxyfactory to create spring proxies using API.

    In short - inside a proxy at runtime i want to cganhe its target object - ? Is this possible ?

    Are there better ways to do this ?
    Very interesting and helpful thread , I have the same problem and corrected it . Thank you both for this useful information .