Package jmri

Interface InstanceManagerAutoInitialize

All Known Implementing Classes:
CarManager, CarManagerXml, DivisionManager, EngineManager, EngineManagerXml, JmriUserPreferencesManager, LocationManager, LocationManagerXml, NceConsistRoster, OperationsManager, OperationsSetupXml, RouteManager, RouteManagerXml, ScheduleManager, ServerFrame, SignalSpeedMap, TrainManager, TrainManagerXml, TrainScheduleManager

public interface InstanceManagerAutoInitialize
Provide a hint to the InstanceManager that this object needs have additional initialization performed after the InstanceManager initially creates it. This allows two classes that have circular dependencies on being able to get the default instance of each other to be managed successfully.

More specifically, the constructors or code called by the constructors of classes implementing the InstanceManagerAutoDefault interface (i.e. that have the InstanceManager automatically create their objects) should never ask the InstanceManager for reference to other automatically-created types. They may ask the InstanceManager for references in their initialize() method, but they can only store those; they can't assume that the objects referred to have completed their initialization and are operational. See the diagram below for why.

Note: the need to have a class implement this probably is indicative of other design issues in the implementing class and its dependencies.

Initialization sequence UML diagram

  • Method Summary

    Modifier and Type Method Description
    void initialize()
    Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.
  • Method Details

    • initialize

      void initialize()
      Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.