What is a Lookup?
Lookup is a mechanism for finding instances of objects. It is pervasively used in NetBeans APIs. The general pattern is that you pass a Class object and get back an instance of that class or null. See the Javadoc for links to articles describing its inspiration and purpose. The simplest way to think of Lookup is that it is a Map where the keys are Class objects and the value for each key is an instance of the key class. There is the global lookup which is used to find objects (often, but not always, singletons) that are registered throughout the system. Also, many types of objects have a method getLookup() that enables other code to get things specific to that object. In particular, Nodes and Project objects have a Lookup. The primary purpose of Lookup is decoupling – it makes it possible to use generic objects to get very specific information, without having to cast objects to a specific type. Confused yet? It’s simple. Take the example of OpenCookie – it has one method, open() that w