2,Repetitive bridging code in table model.

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

William Louth
Listing 2. Repetitive bridging code in table model.


public Object getValueAt(int row, int col) {
 // This table model uses a List object to obtain its displayed data
 // The list would have been passed into the constructor of the table
 //  model
 // The list is the result of the call to the session bean
 CustomerDetails c = (CustomerDetails)_list.get(row);

// Each table model will need to write type specific code to get the
// cell values
 switch(col) {
   case 0: return c.getFirstName();
   case 1: return c.getLastName();
   case 2: return c.getCompany();
   ...
 }
}