Package org.ngengine.components
Interface ComponentLoader
- All Known Implementing Classes:
AppComponentLoader
public interface ComponentLoader
An interface to load resources and configurations for components in a component manager.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canLoad
(ComponentManager mng, Component fragment) Check if the component can be loaded by this loader.int
load
(ComponentManager mng, Component fragment, Runnable markReady) Load the component in the given component manager.void
unload
(ComponentManager mng, Component fragment) Frees up resources and configurations for the component in the given component manager.
-
Method Details
-
load
Load the component in the given component manager. This method is called after the component is initialized- Parameters:
mng
- the component managerfragment
- the component to loadmarkReady
- a runnable that should be called when the loading is complete- Returns:
- how many times the markReady callback is expected to be called to mark the complete loading.
-
unload
Frees up resources and configurations for the component in the given component manager.- Parameters:
mng
- the component managerfragment
- the component to cleanup
-
canLoad
Check if the component can be loaded by this loader. This is used to determine if the component is compatible with this loader and can be initialized without issues. If the component is not compatible, the next available loader in the chain.- Parameters:
mng
- the component managerfragment
- the component to check- Returns:
- true if the component can be initialized, false otherwise
-