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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.