1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.xml;
21  
22  import com.liferay.portal.kernel.xml.Attribute;
23  import com.liferay.portal.kernel.xml.Namespace;
24  import com.liferay.portal.kernel.xml.QName;
25  
26  /**
27   * <a href="AttributeImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   *
31   */
32  public class AttributeImpl extends NodeImpl implements Attribute {
33  
34      public AttributeImpl(org.dom4j.Attribute attribute) {
35          super(attribute);
36  
37          _attribute = attribute;
38      }
39  
40      public Object getData() {
41          return _attribute.getData();
42      }
43  
44      public boolean equals(Object obj) {
45          org.dom4j.Attribute attribute =
46              ((AttributeImpl)obj).getWrappedAttribute();
47  
48          return _attribute.equals(attribute);
49      }
50  
51      public Namespace getNamespace() {
52          org.dom4j.Namespace namespace = _attribute.getNamespace();
53  
54          if (namespace == null) {
55              return null;
56          }
57          else {
58              return new NamespaceImpl(namespace);
59          }
60      }
61  
62      public String getNamespacePrefix() {
63          return _attribute.getNamespacePrefix();
64      }
65  
66      public String getNamespaceURI() {
67          return _attribute.getNamespaceURI();
68      }
69  
70      public QName getQName() {
71          org.dom4j.QName qName = _attribute.getQName();
72  
73          if (qName == null) {
74              return null;
75          }
76          else {
77              return new QNameImpl(qName);
78          }
79      }
80  
81      public String getQualifiedName() {
82          return _attribute.getQualifiedName();
83      }
84  
85      public String getValue() {
86          return _attribute.getValue();
87      }
88  
89      public org.dom4j.Attribute getWrappedAttribute() {
90          return _attribute;
91      }
92  
93      public int hashCode() {
94          return _attribute.hashCode();
95      }
96  
97      public void setData(Object data) {
98          _attribute.setData(data);
99      }
100 
101     public void setNamespace(Namespace namespace) {
102         NamespaceImpl namespaceImpl = (NamespaceImpl)namespace;
103 
104         _attribute.setNamespace(namespaceImpl.getWrappedNamespace());
105     }
106 
107     public void setValue(String value) {
108         _attribute.setValue(value);
109     }
110 
111     private org.dom4j.Attribute _attribute;
112 
113 }