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.xml.ProcessingInstruction;
018    import com.liferay.portal.kernel.xml.Visitor;
019    
020    import java.util.Map;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class ProcessingInstructionImpl
026            extends NodeImpl implements ProcessingInstruction {
027    
028            public ProcessingInstructionImpl(
029                    org.dom4j.ProcessingInstruction processingInstruction) {
030    
031                    super(processingInstruction);
032    
033                    _processingInstruction = processingInstruction;
034            }
035    
036            @Override
037            public <T, V extends Visitor<T>> T accept(V visitor) {
038                    return visitor.visitProcessInstruction(this);
039            }
040    
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof ProcessingInstructionImpl)) {
048                            return false;
049                    }
050    
051                    org.dom4j.ProcessingInstruction processingInstruction =
052                            ((ProcessingInstructionImpl)obj).getWrappedProcessingInstruction();
053    
054                    return _processingInstruction.equals(processingInstruction);
055            }
056    
057            @Override
058            public String getTarget() {
059                    return _processingInstruction.getTarget();
060            }
061    
062            @Override
063            public String getText() {
064                    return _processingInstruction.getText();
065            }
066    
067            @Override
068            public String getValue(String name) {
069                    return _processingInstruction.getValue(name);
070            }
071    
072            @Override
073            public Map<String, String> getValues() {
074                    return _processingInstruction.getValues();
075            }
076    
077            public org.dom4j.ProcessingInstruction getWrappedProcessingInstruction() {
078                    return _processingInstruction;
079            }
080    
081            @Override
082            public int hashCode() {
083                    return _processingInstruction.hashCode();
084            }
085    
086            @Override
087            public boolean removeValue(String name) {
088                    return _processingInstruction.removeValue(name);
089            }
090    
091            @Override
092            public void setTarget(String target) {
093                    _processingInstruction.setTarget(target);
094            }
095    
096            @Override
097            public void setValue(String name, String value) {
098                    _processingInstruction.setValue(name, value);
099            }
100    
101            @Override
102            public void setValues(Map<String, String> data) {
103                    _processingInstruction.setValues(data);
104            }
105    
106            @Override
107            public String toString() {
108                    return _processingInstruction.toString();
109            }
110    
111            private org.dom4j.ProcessingInstruction _processingInstruction;
112    
113    }