Java Reference
In-Depth Information
subclass your existing class. Second, the JTable class requires a collection of objects, and
only an object adapter can adapt information from more than one object.
A class adapter produces a single object that is the adapter. This avoids forwarding calls from
an adapter object to instance(s) of the class that it adapts. A class adapter object simply
translates method names, forwarding calls to itself.
The relative advantages of class and object adapters are small in comparison to the advantage
of having a Java interface that defines the client's needs. In the absence of such an interface,
your adapter object poses as an instance of the client's required type, with no contract defining
the client's needs. In a situation like this you should, if possible, ask the client developers to
build in an interface to which you can adapt.
Search WWH ::




Custom Search