1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.betwixt.schema;
18
19 /***
20 * Models a simpleType tag in an XML schema.
21 * A simple type is an element that cannot have element content
22 * and which has no attributes.
23 *
24 * @author <a href='http://jakarta.apache.org/'>Apache Commons Team</a>
25 * @version $Revision: 1.2 $
26 */
27 public class SimpleType {
28 private String name;
29
30 /***
31 * Gets the name
32 * @return
33 */
34 public String getName() {
35 return name;
36 }
37
38 /***
39 * Sets the name
40 * @param string
41 */
42 public void setName(String name) {
43 this.name = name;
44 }
45
46 public boolean equals(Object obj) {
47 boolean result = false;
48 if (obj instanceof SimpleType) {
49 SimpleType simpleType = (SimpleType) obj;
50 result = isEqual(name, simpleType.name);
51 }
52 return result;
53 }
54
55 public int hashCode() {
56 return 0;
57 }
58
59
60 /***
61 * Null safe equals method
62 * @param one
63 * @param two
64 * @return
65 */
66 private boolean isEqual(String one, String two) {
67 boolean result = false;
68 if (one == null) {
69 result = (two == null);
70 }
71 else
72 {
73 result = one.equals(two);
74 }
75
76 return result;
77 }
78
79 public String toString() {
80 return "<xsd:simpleType name='" + name + "'/>";
81 }
82 }