Writing our own nodes

The preceding section covered those two classes, but what is YearChildFactory? The class RootNode defines for the system the root node of what will become our tree. Each node, though, if it has children, is responsible for loading and building those child Nodes, which is done through this ChildFactory class. Our instance looks like this:

 public class YearChildFactory extends ChildFactory<String> { private final PhotoManager photoManager; private static final Logger LOGGER = Logger.getLogger(YearChildFactory.class.getName()); public YearChildFactory() { this.photoManager = Lookup.getDefault().lookup(PhotoManager.class); if (photoManager == null) { LOGGER.log(Level.SEVERE, "Cannot get PhotoManager object"); LifecycleManager.getDefault().exit(); ...

Get Java 9: Building Robust Modular Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.