001    /**
002     * Copyright (c) 2000-2013 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            @Override
030            public String getName() {
031                    return _documentType.getName();
032            }
033    
034            @Override
035            public String getPublicId() {
036                    if (_documentType == null) {
037                            return null;
038                    }
039    
040                    return _documentType.getPublicID();
041            }
042    
043            @Override
044            public String getSystemId() {
045                    if (_documentType == null) {
046                            return null;
047                    }
048    
049                    return _documentType.getSystemID();
050            }
051    
052            public org.dom4j.DocumentType getWrappedDocumentType() {
053                    return _documentType;
054            }
055    
056            @Override
057            public int hashCode() {
058                    if (_documentType == null) {
059                            return super.hashCode();
060                    }
061    
062                    return _documentType.hashCode();
063            }
064    
065            @Override
066            public String toString() {
067                    if (_documentType == null) {
068                            return StringPool.BLANK;
069                    }
070    
071                    return _documentType.toString();
072            }
073    
074            private org.dom4j.DocumentType _documentType;
075    
076    }