001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.xml;
016    
017    import com.liferay.portal.kernel.xml.Namespace;
018    import com.liferay.portal.kernel.xml.QName;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class QNameImpl implements QName {
024    
025            public QNameImpl(org.dom4j.QName qName) {
026                    _qName = qName;
027            }
028    
029            public boolean equals(Object obj) {
030                    org.dom4j.QName qName = ((QNameImpl)obj).getWrappedQName();
031    
032                    return _qName.equals(qName);
033            }
034    
035            public String getLocalPart() {
036                    return getName();
037            }
038    
039            public String getName() {
040                    return _qName.getName();
041            }
042    
043            public Namespace getNamespace() {
044                    org.dom4j.Namespace namespace = _qName.getNamespace();
045    
046                    if (namespace == null) {
047                            return null;
048                    }
049                    else {
050                            return new NamespaceImpl(namespace);
051                    }
052            }
053    
054            public String getNamespacePrefix() {
055                    return _qName.getNamespacePrefix();
056            }
057    
058            public String getNamespaceURI() {
059                    return _qName.getNamespaceURI();
060            }
061    
062            public String getQualifiedName() {
063                    return _qName.getQualifiedName();
064            }
065    
066            public org.dom4j.QName getWrappedQName() {
067                    return _qName;
068            }
069    
070            public int hashCode() {
071                    return _qName.hashCode();
072            }
073    
074            public String toString() {
075                    return _qName.toString();
076            }
077    
078            private org.dom4j.QName _qName;
079    
080    }