O'Reilly logo

Rich Client Programming: Plugging into the NetBeans Platform by Geertjan Wielenga, Jaroslav Tulach, Tim Boudreau

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

Chapter FiveLookup

The 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 Lookup

image

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 ...

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