| 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 |
package test.encoding; |
| 17 |
|
| 18 |
import org.apache.axis.description.AttributeDesc; |
| 19 |
import org.apache.axis.description.FieldDesc; |
| 20 |
import org.apache.axis.description.TypeDesc; |
| 21 |
import org.apache.axis.encoding.SimpleType; |
| 22 |
|
| 23 |
import javax.xml.namespace.QName; |
| 24 |
|
| 25 |
/** |
| 26 |
* A simple type with attributes for testing |
| 27 |
*/ |
| 28 |
public class SimpleBean implements SimpleType { |
| 29 |
public String value; // Our "actual" value |
| 30 |
public float temp; // An attribute |
| 31 |
|
| 32 |
private static TypeDesc typeDesc = new TypeDesc(SimpleBean.class); |
| 33 |
static { |
| 34 |
FieldDesc fd = new AttributeDesc(); |
| 35 |
fd.setFieldName("temp"); |
| 36 |
fd.setXmlName(new QName("foo", "temp")); |
| 37 |
typeDesc.addFieldDesc(fd); |
| 38 |
} |
| 39 |
public static TypeDesc getTypeDesc() { return typeDesc; } |
| 40 |
|
| 41 |
/** |
| 42 |
* String constructor |
| 43 |
*/ |
| 44 |
public SimpleBean(String val) |
| 45 |
{ |
| 46 |
value = val; |
| 47 |
} |
| 48 |
|
| 49 |
public String getValue() { |
| 50 |
return value; |
| 51 |
} |
| 52 |
|
| 53 |
public void setValue(String value) { |
| 54 |
this.value = value; |
| 55 |
} |
| 56 |
|
| 57 |
public float getTemp() { |
| 58 |
return temp; |
| 59 |
} |
| 60 |
|
| 61 |
public void setTemp(float temp) { |
| 62 |
this.temp = temp; |
| 63 |
} |
| 64 |
|
| 65 |
public String toString() { |
| 66 |
return value; |
| 67 |
} |
| 68 |
|
| 69 |
public boolean equals(Object obj) |
| 70 |
{ |
| 71 |
if (obj == null || !(obj instanceof SimpleBean)) |
| 72 |
return false; |
| 73 |
SimpleBean other = (SimpleBean)obj; |
| 74 |
if (other.getTemp() != temp) { |
| 75 |
return false; |
| 76 |
} |
| 77 |
if (value == null) { |
| 78 |
return other.getValue() == null; |
| 79 |
} |
| 80 |
return value.equals(other.getValue()); |
| 81 |
} |
| 82 |
} |