Lookup class, which we introduced in Chapter 4, is used for much more than just dependency injection. In NetBeans-based applications, it is used for other purposes as well. All of these involve decoupling. This chapter will introduce some of the other ways
Lookup is used in the NetBeans APIs.
The basic usage pattern remains the same for any
Lookup instance, as shown in Example 5.1.
Example 5.1. Using
The code in Example 5.1 asks a
Lookup for an instance of
Foo. If there is at least one
Foo in the
Lookup, it will be returned; otherwise
null will be returned.
Lookup is used pervasively in NetBeans. One way to think ...