001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.xml;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    import com.liferay.portal.kernel.xml.DocumentType;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class DocumentTypeImpl implements DocumentType {
024    
025            public DocumentTypeImpl(org.dom4j.DocumentType documentType) {
026                    _documentType = documentType;
027            }
028    
029            public String getName() {
030                    return _documentType.getName();
031            }
032    
033            public String getPublicId() {
034                    if (_documentType == null) {
035                            return null;
036                    }
037    
038                    return _documentType.getPublicID();
039            }
040    
041            public String getSystemId() {
042                    if (_documentType == null) {
043                            return null;
044                    }
045    
046                    return _documentType.getSystemID();
047            }
048    
049            public org.dom4j.DocumentType getWrappedDocumentType() {
050                    return _documentType;
051            }
052    
053            @Override
054            public int hashCode() {
055                    if (_documentType == null) {
056                            return super.hashCode();
057                    }
058    
059                    return _documentType.hashCode();
060            }
061    
062            @Override
063            public String toString() {
064                    if (_documentType == null) {
065                            return StringPool.BLANK;
066                    }
067    
068                    return _documentType.toString();
069            }
070    
071            private org.dom4j.DocumentType _documentType;
072    
073    }