"Actually," the lead on Chris G's team said defensively, "this is a quite elegant solution for displaying data in a JSP. This way, we don't have to use the real object and can save memory."

And unlike the previous version checked in source control that only went up to ten, this ListBean goes to fourteen...

 

package com.initrodeglobal.util.presentation;

import java.util.ArrayList;

public class ListBean 
{

  String one="",two="",three="",four="",five="",six="",seven="",
         eight="", nine="", ten="", eleven="", twelve="" ,
         thirteen="", fourteen="";
  
  public ListBean()
  {
  }
  
  public ListBean( String one)
  {
    this.one=one;
  }

  public ListBean( String one, String two)
  {
    this.one=one;
    this.two=two;
  }
  
... snip ...
  
  public ListBean( String one, String two, String three, 
                   String four, String five, String six, 
                   String seven, String eight, String nine,
                   String ten,String eleven, String twelve,
                   String thirteen , String fourteen)
  {
    this.one=one;
    this.two=two;
    this.three=three;
    this.four=four;
    this.five=five;
    this.six=six;
    this.seven=seven;
    this.eight=eight;
    this.nine=nine;
    this.ten=ten;
    this.eleven=eleven;
    this.twelve=twelve;
    this.thirteen=thirteen;
    this.fourteen=fourteen;
  }
  
  public ListBean(ArrayList  params)
  {

    for (int a=1;a<=params.size();a++) switch (a)
    {
      case 1 : if (params.get(0) != null) 
        this.one=params.get(0).toString();
        break;
      case 2 : if (params.get(1) != null)
        this.two=params.get(1).toString();
        break;

... snip ...

      case 14 : if (params.get(13) != null)
        this.fourteen=params.get(13).toString();
        break;
    }
  }

  //   --  Setters
  public void setOne( String one)
  {
    this.one=one;
  }

  public void setTwo( String two)
  {
    this.two=two;
  }
    
... snip ...

  //ED: By the setter of the ninth attribute, the argument name was
  //    understandably changed to entry. All those numbers are tiring 
  //    to write!
  public void setFourteen( String entry)
  {
    this.fourteen=entry;
  }
   
  //  -- Getters 
  public String getOne()
  {
    return this.one;
  }

  public String getTwo()
  {
    return this.two;
  }
   
... snip ...
   
  public String getFourteen()
  {
    return this.fourteen;
  }
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!