O'Reilly logo

Java 9: Building Robust Modular Applications by Jason Lee, Peter Verhas, Dr. Edward Lavieri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required