| AttributeImpl.java |
1 /**
2 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.liferay.portal.xml;
24
25 import com.liferay.portal.kernel.xml.Attribute;
26 import com.liferay.portal.kernel.xml.Namespace;
27 import com.liferay.portal.kernel.xml.QName;
28
29 /**
30 * <a href="AttributeImpl.java.html"><b><i>View Source</i></b></a>
31 *
32 * @author Brian Wing Shun Chan
33 *
34 */
35 public class AttributeImpl extends NodeImpl implements Attribute {
36
37 public AttributeImpl(org.dom4j.Attribute attribute) {
38 super(attribute);
39
40 _attribute = attribute;
41 }
42
43 public Object getData() {
44 return _attribute.getData();
45 }
46
47 public boolean equals(Object obj) {
48 org.dom4j.Attribute attribute =
49 ((AttributeImpl)obj).getWrappedAttribute();
50
51 return _attribute.equals(attribute);
52 }
53
54 public Namespace getNamespace() {
55 org.dom4j.Namespace namespace = _attribute.getNamespace();
56
57 if (namespace == null) {
58 return null;
59 }
60 else {
61 return new NamespaceImpl(namespace);
62 }
63 }
64
65 public String getNamespacePrefix() {
66 return _attribute.getNamespacePrefix();
67 }
68
69 public String getNamespaceURI() {
70 return _attribute.getNamespaceURI();
71 }
72
73 public QName getQName() {
74 org.dom4j.QName qName = _attribute.getQName();
75
76 if (qName == null) {
77 return null;
78 }
79 else {
80 return new QNameImpl(qName);
81 }
82 }
83
84 public String getQualifiedName() {
85 return _attribute.getQualifiedName();
86 }
87
88 public String getValue() {
89 return _attribute.getValue();
90 }
91
92 public org.dom4j.Attribute getWrappedAttribute() {
93 return _attribute;
94 }
95
96 public int hashCode() {
97 return _attribute.hashCode();
98 }
99
100 public void setData(Object data) {
101 _attribute.setData(data);
102 }
103
104 public void setNamespace(Namespace namespace) {
105 NamespaceImpl namespaceImpl = (NamespaceImpl)namespace;
106
107 _attribute.setNamespace(namespaceImpl.getWrappedNamespace());
108 }
109
110 public void setValue(String value) {
111 _attribute.setValue(value);
112 }
113
114 private org.dom4j.Attribute _attribute;
115
116 }