1,Repetitive bridging code in swing renderer.

ENTERPRISE JAVA
Bridging the Gap Between Java Clients and EJBs Using XML

William Louth
Listing 1. Repetitive bridging code in swing renderer.


// The renderer needs to have knowledge of all potential classes and
// their respective icons
if( obj instanceof Customer)
 icon = iconCustomer;
else if( obj instanceof Order)
 icon = iconOrder;
...
setIcon(icon);