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();
   ...
 }
}

Upcoming Training Events

0 AM
Visual Studio Live! San Diego
September 8-12, 2025
Live! 360 Orlando
November 16-21, 2025
Cloud & Containers Live! Orlando
November 16-21, 2025
Data Platform Live! Orlando
November 16-21, 2025
Visual Studio Live! Orlando
November 16-21, 2025