Interface ComponentInitializer

All Known Implementing Classes:
AppComponentInitializer

public interface ComponentInitializer
An interface to initializing and cleaning up components in the component manager. This is used to perform any necessary setup or teardown for a component when it is added or removed.
  • Method Details

    • initialize

      int initialize(ComponentManager mng, Component fragment, Runnable markReady)
      Initialize the component in the given component manager. This method is called when the component is added to the component manager.
      Parameters:
      mng - the component manager
      fragment - the component to initialize
      markReady - a runnable that should be called when the initialization is complete
      Returns:
      how many times the markReady callback is expected to be called to mark the complete initialization.
    • cleanup

      void cleanup(ComponentManager mng, Component fragment)
      Cleanup the component in the given component manager. This method is called when the component is removed from the component manager.
      Parameters:
      mng - the component manager
      fragment - the component to cleanup
    • canInitialize

      boolean canInitialize(ComponentManager mng, Component fragment)
      Check if the component can be initialized by this initializer. This is used to determine if the component is compatible with this initializer and can be initialized without issues. If the component is not compatible, it will not be initialized and the component manager will call the next available initializer in the chain.
      Parameters:
      mng - the component manager
      fragment - the component to check
      Returns:
      true if the component can be initialized, false otherwise