blob: 8952148c16b12b260ab509b516e046d00d4705c2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 by SAP AG, Walldorf.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SAP AG - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.dom.runtime.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
/**
* <!-- begin-user-doc -->
* The <b>Switch</b> for the model's inheritance hierarchy.
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
* to invoke the <code>caseXXX</code> method for each class of the model,
* starting with the actual class of the object
* and proceeding up the inheritance hierarchy
* until a non-null result is returned,
* which is the result of the switch.
* <!-- end-user-doc -->
* @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage
* @generated
*/
public class DomSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static DomPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DomSwitch() {
if (modelPackage == null)
{
modelPackage = DomPackage.eINSTANCE;
}
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
public T doSwitch(EObject theEObject) {
return doSwitch(theEObject.eClass(), theEObject);
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
protected T doSwitch(EClass theEClass, EObject theEObject) {
if (theEClass.eContainer() == modelPackage)
{
return doSwitch(theEClass.getClassifierID(), theEObject);
}
else
{
List<EClass> eSuperTypes = theEClass.getESuperTypes();
return
eSuperTypes.isEmpty() ?
defaultCase(theEObject) :
doSwitch(eSuperTypes.get(0), theEObject);
}
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID)
{
case DomPackage.IDOM:
{
IDOM idom = (IDOM)theEObject;
T result = caseIDOM(idom);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IJAVA_WEB_SERVICE_ELEMENT:
{
IJavaWebServiceElement iJavaWebServiceElement = (IJavaWebServiceElement)theEObject;
T result = caseIJavaWebServiceElement(iJavaWebServiceElement);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.ISERVICE_ENDPOINT_INTERFACE:
{
IServiceEndpointInterface iServiceEndpointInterface = (IServiceEndpointInterface)theEObject;
T result = caseIServiceEndpointInterface(iServiceEndpointInterface);
if (result == null) result = caseIJavaWebServiceElement(iServiceEndpointInterface);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IWEB_METHOD:
{
IWebMethod iWebMethod = (IWebMethod)theEObject;
T result = caseIWebMethod(iWebMethod);
if (result == null) result = caseIJavaWebServiceElement(iWebMethod);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IWEB_PARAM:
{
IWebParam iWebParam = (IWebParam)theEObject;
T result = caseIWebParam(iWebParam);
if (result == null) result = caseIJavaWebServiceElement(iWebParam);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IWEB_SERVICE:
{
IWebService iWebService = (IWebService)theEObject;
T result = caseIWebService(iWebService);
if (result == null) result = caseIJavaWebServiceElement(iWebService);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IWEB_SERVICE_PROJECT:
{
IWebServiceProject iWebServiceProject = (IWebServiceProject)theEObject;
T result = caseIWebServiceProject(iWebServiceProject);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DomPackage.IWEB_TYPE:
{
IWebType iWebType = (IWebType)theEObject;
T result = caseIWebType(iWebType);
if (result == null) result = caseIJavaWebServiceElement(iWebType);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>IDOM</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IDOM</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIDOM(IDOM object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IJava Web Service Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IJava Web Service Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIJavaWebServiceElement(IJavaWebServiceElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IService Endpoint Interface</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IService Endpoint Interface</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIServiceEndpointInterface(IServiceEndpointInterface object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IWeb Method</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IWeb Method</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIWebMethod(IWebMethod object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IWeb Param</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IWeb Param</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIWebParam(IWebParam object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IWeb Service</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IWeb Service</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIWebService(IWebService object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IWeb Service Project</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IWeb Service Project</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIWebServiceProject(IWebServiceProject object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IWeb Type</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>IWeb Type</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIWebType(IWebType object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
public T defaultCase(EObject object) {
return null;
}
} //DomSwitch