1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.xml;
16  
17  import com.liferay.portal.kernel.xml.Attribute;
18  import com.liferay.portal.kernel.xml.Namespace;
19  import com.liferay.portal.kernel.xml.QName;
20  
21  /**
22   * <a href="AttributeImpl.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Brian Wing Shun Chan
25   */
26  public class AttributeImpl extends NodeImpl implements Attribute {
27  
28      public AttributeImpl(org.dom4j.Attribute attribute) {
29          super(attribute);
30  
31          _attribute = attribute;
32      }
33  
34      public Object getData() {
35          return _attribute.getData();
36      }
37  
38      public boolean equals(Object obj) {
39          org.dom4j.Attribute attribute =
40              ((AttributeImpl)obj).getWrappedAttribute();
41  
42          return _attribute.equals(attribute);
43      }
44  
45      public Namespace getNamespace() {
46          org.dom4j.Namespace namespace = _attribute.getNamespace();
47  
48          if (namespace == null) {
49              return null;
50          }
51          else {
52              return new NamespaceImpl(namespace);
53          }
54      }
55  
56      public String getNamespacePrefix() {
57          return _attribute.getNamespacePrefix();
58      }
59  
60      public String getNamespaceURI() {
61          return _attribute.getNamespaceURI();
62      }
63  
64      public QName getQName() {
65          org.dom4j.QName qName = _attribute.getQName();
66  
67          if (qName == null) {
68              return null;
69          }
70          else {
71              return new QNameImpl(qName);
72          }
73      }
74  
75      public String getQualifiedName() {
76          return _attribute.getQualifiedName();
77      }
78  
79      public String getValue() {
80          return _attribute.getValue();
81      }
82  
83      public org.dom4j.Attribute getWrappedAttribute() {
84          return _attribute;
85      }
86  
87      public int hashCode() {
88          return _attribute.hashCode();
89      }
90  
91      public void setData(Object data) {
92          _attribute.setData(data);
93      }
94  
95      public void setNamespace(Namespace namespace) {
96          NamespaceImpl namespaceImpl = (NamespaceImpl)namespace;
97  
98          _attribute.setNamespace(namespaceImpl.getWrappedNamespace());
99      }
100 
101     public void setValue(String value) {
102         _attribute.setValue(value);
103     }
104 
105     public String toString() {
106         return _attribute.toString();
107     }
108 
109     private org.dom4j.Attribute _attribute;
110 
111 }