March 2002
Intermediate to advanced
496 pages
8h 51m
English
When you need to adapt your code to meet a client's needs, you may find that the client planned for such circumstances. This is evident when the client's developers provide a Java interface that defines the services the client code needs, as in the example shown in Figure 3.1. A client class in a package makes calls to a service() method that is declared in a Java interface. Suppose that you have found an existing class with a method that can fulfill the client's needs, but the name of the method is usefulMethod(). You can adapt the existing class to meet the client's needs by writing a class that extends ExistingClass, implements ThoughtfulInterface, and overrides service() so that it delegates its requests ...
Read now
Unlock full access