1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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     private org.dom4j.Attribute _attribute;
106 
107 }