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:18:57 GMT
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;
    }

    public String getVar10() {
        return var10;
    }

    public void setVar10(String var10) {
        this.var10 = var10;
    }

    public String toString(){
        StringBuffer sb = new StringBuffer();
        sb.append("StringClass: [\n");
        sb.append("var1=" + var1 + "\n");
        sb.append("var2=" + var2 + "\n");
        sb.append("var3=" + var3 + "\n");
        sb.append("var4=" + var4 + "\n");
        sb.append("var5=" + var5 + "\n");
        sb.append("var6=" + var6 + "\n");
        sb.append("var7=" + var7 + "\n");
        sb.append("var8=" + var8 + "\n");
        sb.append("var9=" + var9 + "\n");
        sb.append("var10=" + var10 + "\n");
        sb.append("]\n");
        return sb.toString();

    }

}


-----Original Message-----
From: Julie.Huang@mizuhocbus.com
[mailto:Julie.Huang@mizuhocbus.com]
Sent: Wednesday, September 24, 2003 3:13 PM
To: Struts Users Mailing List
Subject: LabelValueBean - 3 fields?


Hi, is it possible to store 3 fields in LabelValueBean
instead of 2?
i.e. value, label & description?

thanx! 


---------------------------------------------------------------------
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