struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Varun Garg <varun_g...@yahoo.com>
Subject RE: LabelValueBean - 3 fields?
Date Wed, 24 Sep 2003 20:29:16 GMT
It is easier to use this class for Display purposes
just like the LabelValueBean.



-----Original Message-----
From: David Graham [mailto:grahamdavid1980@yahoo.com]
Sent: Wednesday, September 24, 2003 3:23 PM
To: Struts Users Mailing List
Subject: RE: LabelValueBean - 3 fields?


If you need a class that stores 10 Strings, you should
be using an array
instead of 10 different variables.

David

--- Varun Garg <varun_garg@yahoo.com> wrote:
> I created a StringsClass with upto 10 variables.
> 
> 
> package com.xxx.valueobjects;
> 
> import java.io.Serializable;
> import java.util.Comparator;
> 
> public class StringsClass  implements Serializable,
> Comparable  {
>     private String var1 = "";
>     private String var2 = "";
>     private String var3 = "";
>     private String var4 = "";
>     private String var5 = "";
>     private String var6 = "";
>     private String var7 = "";
>     private String var8 = "";
>     private String var9 = "";
>     private String var10 = "";
> 
>    public int compareTo(Object inObj) {
>        StringsClass in  = (StringsClass) inObj;
>        String first = var1 + var2 + var3 + var4 +
var5
> + var6 + var7 + var8 + var9 + var10;
>        String second = in.getVar1() + in.getVar2() +
> in.getVar3() + in.getVar4() + in.getVar5() +
> in.getVar6();
>        second = second + in.getVar7() +in.getVar8()
> +in.getVar9() +in.getVar10();
>        return first.compareTo(second);
>    }
> 
>     public StringsClass(String var1) {
>         this.var1 = var1;
>     }
> 
>     public StringsClass(String var1, String var2) {
>         this.var1 = var1;
>         this.var2 = var2;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5, String var6)
{
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>         this.var6 = var6;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5, String var6,
> String var7) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>         this.var6 = var6;
>         this.var7 = var7;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5, String var6,
> String var7, String var8) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>         this.var6 = var6;
>         this.var7 = var7;
>         this.var8 = var8;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5, String var6,
> String var7, String var8, String var9) {
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>         this.var6 = var6;
>         this.var7 = var7;
>         this.var8 = var8;
>         this.var9 = var9;
>     }
> 
>     public StringsClass(String var1, String var2,
> String var3, String var4, String var5, String var6,
> String var7, String var8, String var9, String var10)
{
>         this.var1 = var1;
>         this.var2 = var2;
>         this.var3 = var3;
>         this.var4 = var4;
>         this.var5 = var5;
>         this.var6 = var6;
>         this.var7 = var7;
>         this.var8 = var8;
>         this.var9 = var9;
>         this.var10 = var10;
>     }
> 
>     public String getVar1() {
>         return var1;
>     }
> 
>     public void setVar1(String var1) {
>         this.var1 = var1;
>     }
> 
>     public String getVar2() {
>         return var2;
>     }
> 
>     public void setVar2(String var2) {
>         this.var2 = var2;
>     }
> 
>     public String getVar3() {
>         return var3;
>     }
> 
>     public void setVar3(String var3) {
>         this.var3 = var3;
>     }
> 
>     public String getVar4() {
>         return var4;
>     }
> 
>     public void setVar4(String var4) {
>         this.var4 = var4;
>     }
> 
>     public String getVar5() {
>         return var5;
>     }
> 
>     public void setVar5(String var5) {
>         this.var5 = var5;
>     }
> 
>     public String getVar6() {
>         return var6;
>     }
> 
>     public void setVar6(String var6) {
>         this.var6 = var6;
>     }
> 
>     public String getVar7() {
>         return var7;
>     }
> 
>     public void setVar7(String var7) {
>         this.var7 = var7;
>     }
> 
>     public String getVar8() {
>         return var8;
>     }
> 
>     public void setVar8(String var8) {
>         this.var8 = var8;
>     }
> 
>     public String getVar9() {
>         return var9;
>     }
> 
>     public void setVar9(String var9) {
>         this.var9 = var9;
>     }
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design
software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail:
struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message