1 /*******************************************************************************
2 * Copyright (c) 2015 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Obeo - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.emf
.compare
.ide
.internal
.utils
;
13 import java
.util
.List
;
16 import org
.eclipse
.emf
.common
.util
.EMap
;
17 import org
.eclipse
.emf
.common
.util
.URI
;
18 import org
.eclipse
.emf
.ecore
.EClass
;
19 import org
.eclipse
.emf
.ecore
.EClassifier
;
20 import org
.eclipse
.emf
.ecore
.EDataType
;
21 import org
.eclipse
.emf
.ecore
.EFactory
;
22 import org
.eclipse
.emf
.ecore
.ENamedElement
;
23 import org
.eclipse
.emf
.ecore
.EObject
;
24 import org
.eclipse
.emf
.ecore
.EPackage
;
25 import org
.eclipse
.emf
.ecore
.EStructuralFeature
;
26 import org
.eclipse
.emf
.ecore
.util
.ExtendedMetaData
;
27 import org
.eclipse
.emf
.ecore
.xmi
.DanglingHREFException
;
28 import org
.eclipse
.emf
.ecore
.xmi
.NameInfo
;
29 import org
.eclipse
.emf
.ecore
.xmi
.XMIException
;
30 import org
.eclipse
.emf
.ecore
.xmi
.XMLHelper
;
31 import org
.eclipse
.emf
.ecore
.xmi
.XMLResource
;
32 import org
.eclipse
.emf
.ecore
.xmi
.XMLResource
.XMLMap
;
35 * This implementation of an {@link XMLHelper} will forward all calls to its delegate.
37 * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
39 public class ForwardingXMLHelper
implements XMLHelper
{
40 /** The actual helper we'll delegate all calls to. */
41 private final XMLHelper delegate
;
44 * Default constructor.
47 * The actual helper we'll delegate all calls to.
49 public ForwardingXMLHelper(XMLHelper delegate
) {
50 this.delegate
= delegate
;
54 public void setOptions(Map
<?
, ?
> options
) {
55 delegate
.setOptions(options
);
59 public void setNoNamespacePackage(EPackage pkg
) {
60 delegate
.setNoNamespacePackage(pkg
);
64 public EPackage
getNoNamespacePackage() {
65 return delegate
.getNoNamespacePackage();
69 public void setAnySimpleType(EClass type
) {
70 delegate
.setAnySimpleType(type
);
74 public void setXMLMap(XMLMap map
) {
75 delegate
.setXMLMap(map
);
79 public XMLMap
getXMLMap() {
80 return delegate
.getXMLMap();
84 public void setExtendedMetaData(ExtendedMetaData extendedMetaData
) {
85 delegate
.setExtendedMetaData(extendedMetaData
);
89 public ExtendedMetaData
getExtendedMetaData() {
90 return delegate
.getExtendedMetaData();
94 public XMLResource
getResource() {
95 return delegate
.getResource();
99 public Object
getValue(EObject eObject
, EStructuralFeature eStructuralFeature
) {
100 return delegate
.getValue(eObject
, eStructuralFeature
);
104 public String
getName(ENamedElement eNamedElement
) {
105 return delegate
.getName(eNamedElement
);
109 public String
getQName(EClass eClass
) {
110 return delegate
.getQName(eClass
);
114 public void populateNameInfo(NameInfo nameInfo
, EClass eClass
) {
115 delegate
.populateNameInfo(nameInfo
, eClass
);
119 public String
getQName(EDataType eDataType
) {
120 return delegate
.getQName(eDataType
);
124 public void populateNameInfo(NameInfo nameInfo
, EDataType eDataType
) {
125 delegate
.populateNameInfo(nameInfo
, eDataType
);
129 public String
getQName(EStructuralFeature feature
) {
130 return delegate
.getQName(feature
);
134 public void populateNameInfo(NameInfo nameInfo
, EStructuralFeature feature
) {
135 delegate
.populateNameInfo(nameInfo
, feature
);
139 public String
getPrefix(String namespaceURI
) {
140 return delegate
.getPrefix(namespaceURI
);
144 public String
getPrefix(EPackage ePackage
) {
145 return delegate
.getPrefix(ePackage
);
149 public String
getNamespaceURI(String prefix
) {
150 return delegate
.getNamespaceURI(prefix
);
154 public List
<String
> getPrefixes(EPackage ePackage
) {
155 return delegate
.getPrefixes(ePackage
);
159 public String
getID(EObject eObject
) {
160 return delegate
.getID(eObject
);
164 public String
getIDREF(EObject eObject
) {
165 return delegate
.getIDREF(eObject
);
169 public String
getHREF(EObject eObject
) {
170 return delegate
.getHREF(eObject
);
174 public URI
deresolve(URI uri
) {
175 return delegate
.deresolve(uri
);
179 public EPackage
[] packages() {
180 return delegate
.packages();
189 public EObject
createObject(EFactory eFactory
, String name
) {
190 return delegate
.createObject(eFactory
, name
);
194 public EObject
createObject(EFactory eFactory
, EClassifier type
) {
195 return delegate
.createObject(eFactory
, type
);
199 public EClassifier
getType(EFactory eFactory
, String typeName
) {
200 return delegate
.getType(eFactory
, typeName
);
204 public void setValue(EObject eObject
, EStructuralFeature eStructuralFeature
, Object value
, int position
) {
205 delegate
.setValue(eObject
, eStructuralFeature
, value
, position
);
209 public EStructuralFeature
getFeature(EClass eClass
, String namespaceURI
, String name
) {
210 return delegate
.getFeature(eClass
, namespaceURI
, name
);
214 public EStructuralFeature
getFeature(EClass eClass
, String namespaceURI
, String name
, boolean isElement
) {
215 return delegate
.getFeature(eClass
, namespaceURI
, name
, isElement
);
219 public int getFeatureKind(EStructuralFeature feature
) {
220 return delegate
.getFeatureKind(feature
);
224 public String
getXMLEncoding(String javaEncoding
) {
225 return delegate
.getXMLEncoding(javaEncoding
);
229 public String
getJavaEncoding(String xmlEncoding
) {
230 return delegate
.getJavaEncoding(xmlEncoding
);
234 public List
<XMIException
> setManyReference(ManyReference reference
, String location
) {
235 return delegate
.setManyReference(reference
, location
);
239 public void setCheckForDuplicates(boolean checkForDuplicates
) {
240 delegate
.setCheckForDuplicates(checkForDuplicates
);
244 public void setProcessDanglingHREF(String value
) {
245 delegate
.setProcessDanglingHREF(value
);
249 public DanglingHREFException
getDanglingHREFException() {
250 return delegate
.getDanglingHREFException();
254 public URI
resolve(URI relative
, URI base
) {
255 return delegate
.resolve(relative
, base
);
259 public void addPrefix(String prefix
, String uri
) {
260 delegate
.addPrefix(prefix
, uri
);
264 public Map
<String
, String
> getAnyContentPrefixToURIMapping() {
265 return delegate
.getAnyContentPrefixToURIMapping();
269 public void recordPrefixToURIMapping() {
270 delegate
.recordPrefixToURIMapping();
274 public String
getURI(String prefix
) {
275 return delegate
.getURI(prefix
);
279 public void pushContext() {
280 delegate
.pushContext();
284 public void popContext() {
285 delegate
.popContext();
289 public void popContext(Map
<String
, EFactory
> prefixesToFactories
) {
290 delegate
.popContext(prefixesToFactories
);
294 public String
convertToString(EFactory factory
, EDataType dataType
, Object data
) {
295 return delegate
.convertToString(factory
, dataType
, data
);
299 public EMap
<String
, String
> getPrefixToNamespaceMap() {
300 return delegate
.getPrefixToNamespaceMap();
304 public void setPrefixToNamespaceMap(EMap
<String
, String
> prefixToNamespaceMap
) {
305 delegate
.setPrefixToNamespaceMap(prefixToNamespaceMap
);
309 public void setMustHavePrefix(boolean mustHavePrefix
) {
310 delegate
.setMustHavePrefix(mustHavePrefix
);