Announcement Announcement Module
No announcement yet.
init methods before properties set? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • init methods before properties set?


    I was just wondering if an init method specified on an object should occur after all properties have been set on all other objects in the ApplicationContext (as in the Java Spring)

    as an example I have two objects ...

    ... DownloadManager has a reference to ScheduleManager, and in its setter adds a listener for when a Schedule is downloaded, and a schedule is first downloaded (or loaded from a file synchronously) in the ScheduleManager init method

    So I would expect things to happen in this order
    1. DownloadManager / ScheduleManager constructed
    2. setScheduleManager called on DownloadManager
    3. init called on ScheduleManager

    But I can see it happening in the step 3 and then 2 order.

    Just wondering if i'm on the right path thinking things should happen in this order.

  • #2
    You are correct

    You may try using the IInitiatingObject interface instead of an init method.
    you need to implement
    public void afterPropertiesSet():void