KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > interop3 > groupE > SOAPStruct


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package test.wsdl.interop3.groupE;
18  
19 /**
20  * Test structure used by the WSDLInteropTestDocLitService.
21  * Note: this implementation does not allow null values for varInt or varFloat.
22  *
23  * @author Glyn Normington <glyn@apache.org>
24  * @author Sam Ruby <rubys@us.ibm.com>
25  */

26 public class SOAPStruct {
27
28     // items of the structure. String permits nulls.
29
private float varFloat;
30     private int varInt;
31     private String JavaDoc varString;
32
33     /**
34      * null constructor
35      */

36     public SOAPStruct() {}
37
38     /**
39      * convenience constructor that sets all of the fields
40      */

41     public SOAPStruct(float f, int i, String JavaDoc s) {
42         this.varFloat = f;
43         this.varInt = i;
44         this.varString = s;
45     }
46
47     /**
48      * bean getter for VarInt
49      */

50     public int getVarInt() {
51         return varInt;
52     }
53
54     /**
55      * bean setter for VarInt
56      */

57     public void setVarInt(int varInt) {
58         this.varInt = varInt;
59     }
60
61     /**
62      * bean getter for VarString
63      */

64     public String JavaDoc getVarString() {
65         return varString;
66     }
67
68     /**
69      * bean setter for VarString
70      */

71     public void setVarString(String JavaDoc varString) {
72         this.varString = varString;
73     }
74
75     /**
76      * bean getter for VarFloat
77      */

78     public float getVarFloat() {
79         return varFloat;
80     }
81
82     /**
83      * bean setter for VarFloat
84      */

85     public void setVarFloat(float varFloat) {
86         this.varFloat=varFloat;
87     }
88
89     /**
90      * Equality comparison.
91      */

92     public boolean equals(Object JavaDoc object) {
93         if (!(object instanceof SOAPStruct)) return false;
94
95         SOAPStruct that = (SOAPStruct)object;
96
97         if (this.varInt != that.varInt) return false;
98
99         if (this.varFloat != that.varFloat) return false;
100
101         if (this.varString == null) {
102             if (that.varString != null) return false;
103         } else {
104             if (!this.varString.equals(that.varString)) return false;
105         }
106
107         return true;
108     }
109
110     /**
111      * Printable representation
112      */

113     public String JavaDoc toString() {
114         return "{" + varInt + ", \"" + varString + "\", " + varFloat + "}";
115     }
116 }
117
Popular Tags