001    /**
002     * Copyright (c) 2000-present 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.util.Validator;
019    import com.liferay.portal.kernel.xml.DocumentType;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class DocumentTypeImpl implements DocumentType {
025    
026            public DocumentTypeImpl(org.dom4j.DocumentType documentType) {
027                    _documentType = documentType;
028            }
029    
030            @Override
031            public boolean equals(Object obj) {
032                    if (this == obj) {
033                            return true;
034                    }
035    
036                    if (!(obj instanceof DocumentTypeImpl)) {
037                            return false;
038                    }
039    
040                    DocumentTypeImpl documentTypeImpl = (DocumentTypeImpl)obj;
041    
042                    if (Validator.equals(_documentType, documentTypeImpl._documentType)) {
043                            return true;
044                    }
045    
046                    return false;
047            }
048    
049            @Override
050            public String getName() {
051                    return _documentType.getName();
052            }
053    
054            @Override
055            public String getPublicId() {
056                    if (_documentType == null) {
057                            return null;
058                    }
059    
060                    return _documentType.getPublicID();
061            }
062    
063            @Override
064            public String getSystemId() {
065                    if (_documentType == null) {
066                            return null;
067                    }
068    
069                    return _documentType.getSystemID();
070            }
071    
072            public org.dom4j.DocumentType getWrappedDocumentType() {
073                    return _documentType;
074            }
075    
076            @Override
077            public int hashCode() {
078                    if (_documentType == null) {
079                            return super.hashCode();
080                    }
081    
082                    return _documentType.hashCode();
083            }
084    
085            @Override
086            public String toString() {
087                    if (_documentType == null) {
088                            return StringPool.BLANK;
089                    }
090    
091                    return _documentType.toString();
092            }
093    
094            private org.dom4j.DocumentType _documentType;
095    
096    }