Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
SimpleType |
|
| 1.3333333333333333;1.333 |
1 | /* |
|
2 | * Copyright 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 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: 190509 $ |
|
26 | */ |
|
27 | 0 | public class SimpleType { |
28 | private String name; |
|
29 | ||
30 | /** |
|
31 | * Gets the name |
|
32 | * @return the name of this type |
|
33 | */ |
|
34 | public String getName() { |
|
35 | 0 | return name; |
36 | } |
|
37 | ||
38 | /** |
|
39 | * Sets the name |
|
40 | * @param name |
|
41 | */ |
|
42 | public void setName(String name) { |
|
43 | 0 | this.name = name; |
44 | 0 | } |
45 | ||
46 | public boolean equals(Object obj) { |
|
47 | 0 | boolean result = false; |
48 | 0 | if (obj instanceof SimpleType) { |
49 | 0 | SimpleType simpleType = (SimpleType) obj; |
50 | 0 | result = isEqual(name, simpleType.name); |
51 | } |
|
52 | 0 | return result; |
53 | } |
|
54 | ||
55 | public int hashCode() { |
|
56 | 0 | 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 | 0 | boolean result = false; |
68 | 0 | if (one == null) { |
69 | 0 | result = (two == null); |
70 | } |
|
71 | else |
|
72 | { |
|
73 | 0 | result = one.equals(two); |
74 | } |
|
75 | ||
76 | 0 | return result; |
77 | } |
|
78 | ||
79 | public String toString() { |
|
80 | 0 | return "<xsd:simpleType name='" + name + "'/>"; |
81 | } |
|
82 | } |