org.eclipse.emf.ecore.xcore.util
Class XcoreSwitch<T>

java.lang.Object
  extended by org.eclipse.emf.ecore.util.Switch<T>
      extended by org.eclipse.emf.ecore.xcore.util.XcoreSwitch<T>

public class XcoreSwitch<T>
extends Switch<T>

The Switch for the model's inheritance hierarchy. It supports the call doSwitch(object) to invoke the caseXXX 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.

See Also:
XcorePackage

Field Summary
protected static XcorePackage modelPackage
          The cached model package
 
Constructor Summary
XcoreSwitch()
          Creates an instance of the switch
 
Method Summary
 T caseXAnnotation(XAnnotation object)
          Returns the result of interpreting the object as an instance of 'XAnnotation'
 T caseXAnnotationDirective(XAnnotationDirective object)
          Returns the result of interpreting the object as an instance of 'XAnnotation Directive'
 T caseXAttribute(XAttribute object)
          Returns the result of interpreting the object as an instance of 'XAttribute'
 T caseXClass(XClass object)
          Returns the result of interpreting the object as an instance of 'XClass'
 T caseXClassifier(XClassifier object)
          Returns the result of interpreting the object as an instance of 'XClassifier'
 T caseXDataType(XDataType object)
          Returns the result of interpreting the object as an instance of 'XData Type'
 T caseXEnum(XEnum object)
          Returns the result of interpreting the object as an instance of 'XEnum'
 T caseXEnumLiteral(XEnumLiteral object)
          Returns the result of interpreting the object as an instance of 'XEnum Literal'
 T caseXGenericType(XGenericType object)
          Returns the result of interpreting the object as an instance of 'XGeneric Type'
 T caseXImportDirective(XImportDirective object)
          Returns the result of interpreting the object as an instance of 'XImport Directive'
 T caseXMember(XMember object)
          Returns the result of interpreting the object as an instance of 'XMember'
 T caseXModelElement(XModelElement object)
          Returns the result of interpreting the object as an instance of 'XModel Element'
 T caseXNamedElement(XNamedElement object)
          Returns the result of interpreting the object as an instance of 'XNamed Element'
 T caseXOperation(XOperation object)
          Returns the result of interpreting the object as an instance of 'XOperation'
 T caseXPackage(XPackage object)
          Returns the result of interpreting the object as an instance of 'XPackage'
 T caseXParameter(XParameter object)
          Returns the result of interpreting the object as an instance of 'XParameter'
 T caseXReference(XReference object)
          Returns the result of interpreting the object as an instance of 'XReference'
 T caseXStringToStringMapEntry(java.util.Map.Entry<java.lang.String,java.lang.String> object)
          Returns the result of interpreting the object as an instance of 'XString To String Map Entry'
 T caseXStructuralFeature(XStructuralFeature object)
          Returns the result of interpreting the object as an instance of 'XStructural Feature'
 T caseXTypedElement(XTypedElement object)
          Returns the result of interpreting the object as an instance of 'XTyped Element'
 T caseXTypeParameter(XTypeParameter object)
          Returns the result of interpreting the object as an instance of 'XType Parameter'
 T defaultCase(EObject object)
          Returns the result of interpreting the object as an instance of 'EObject'
protected  T doSwitch(int classifierID, EObject theEObject)
          Calls caseXXX for each class of the model until one returns a non null result; it yields that result
protected  boolean isSwitchFor(EPackage ePackage)
          Checks whether this is a switch for the given package
 
Methods inherited from class org.eclipse.emf.ecore.util.Switch
doSwitch, doSwitch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelPackage

protected static XcorePackage modelPackage
The cached model package

Constructor Detail

XcoreSwitch

public XcoreSwitch()
Creates an instance of the switch.

Method Detail

isSwitchFor

protected boolean isSwitchFor(EPackage ePackage)
Checks whether this is a switch for the given package.

Specified by:
isSwitchFor in class Switch<T>
Parameters:
ePackage - the package of interest.
Returns:
whether this is a switch for the given package.

doSwitch

protected T doSwitch(int classifierID,
                     EObject theEObject)
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Overrides:
doSwitch in class Switch<T>
Parameters:
classifierID - the classifier ID of the (super-)class of eObject relative to its defining EPackage.
theEObject - the model object to pass to the appropriate caseXXX method.
Returns:
the first non-null result returned by a caseXXX call.

caseXAnnotation

public T caseXAnnotation(XAnnotation object)
Returns the result of interpreting the object as an instance of 'XAnnotation'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XAnnotation'.
See Also:
doSwitch(EObject)

caseXAnnotationDirective

public T caseXAnnotationDirective(XAnnotationDirective object)
Returns the result of interpreting the object as an instance of 'XAnnotation Directive'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XAnnotation Directive'.
See Also:
doSwitch(EObject)

caseXAttribute

public T caseXAttribute(XAttribute object)
Returns the result of interpreting the object as an instance of 'XAttribute'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XAttribute'.
See Also:
doSwitch(EObject)

caseXClass

public T caseXClass(XClass object)
Returns the result of interpreting the object as an instance of 'XClass'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XClass'.
See Also:
doSwitch(EObject)

caseXClassifier

public T caseXClassifier(XClassifier object)
Returns the result of interpreting the object as an instance of 'XClassifier'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XClassifier'.
See Also:
doSwitch(EObject)

caseXDataType

public T caseXDataType(XDataType object)
Returns the result of interpreting the object as an instance of 'XData Type'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XData Type'.
See Also:
doSwitch(EObject)

caseXEnum

public T caseXEnum(XEnum object)
Returns the result of interpreting the object as an instance of 'XEnum'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XEnum'.
See Also:
doSwitch(EObject)

caseXEnumLiteral

public T caseXEnumLiteral(XEnumLiteral object)
Returns the result of interpreting the object as an instance of 'XEnum Literal'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XEnum Literal'.
See Also:
doSwitch(EObject)

caseXModelElement

public T caseXModelElement(XModelElement object)
Returns the result of interpreting the object as an instance of 'XModel Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XModel Element'.
See Also:
doSwitch(EObject)

caseXNamedElement

public T caseXNamedElement(XNamedElement object)
Returns the result of interpreting the object as an instance of 'XNamed Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XNamed Element'.
See Also:
doSwitch(EObject)

caseXOperation

public T caseXOperation(XOperation object)
Returns the result of interpreting the object as an instance of 'XOperation'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XOperation'.
See Also:
doSwitch(EObject)

caseXPackage

public T caseXPackage(XPackage object)
Returns the result of interpreting the object as an instance of 'XPackage'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XPackage'.
See Also:
doSwitch(EObject)

caseXParameter

public T caseXParameter(XParameter object)
Returns the result of interpreting the object as an instance of 'XParameter'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XParameter'.
See Also:
doSwitch(EObject)

caseXReference

public T caseXReference(XReference object)
Returns the result of interpreting the object as an instance of 'XReference'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XReference'.
See Also:
doSwitch(EObject)

caseXStructuralFeature

public T caseXStructuralFeature(XStructuralFeature object)
Returns the result of interpreting the object as an instance of 'XStructural Feature'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XStructural Feature'.
See Also:
doSwitch(EObject)

caseXTypedElement

public T caseXTypedElement(XTypedElement object)
Returns the result of interpreting the object as an instance of 'XTyped Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XTyped Element'.
See Also:
doSwitch(EObject)

caseXStringToStringMapEntry

public T caseXStringToStringMapEntry(java.util.Map.Entry<java.lang.String,java.lang.String> object)
Returns the result of interpreting the object as an instance of 'XString To String Map Entry'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XString To String Map Entry'.
See Also:
doSwitch(EObject)

caseXGenericType

public T caseXGenericType(XGenericType object)
Returns the result of interpreting the object as an instance of 'XGeneric Type'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XGeneric Type'.
See Also:
doSwitch(EObject)

caseXImportDirective

public T caseXImportDirective(XImportDirective object)
Returns the result of interpreting the object as an instance of 'XImport Directive'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XImport Directive'.
See Also:
doSwitch(EObject)

caseXMember

public T caseXMember(XMember object)
Returns the result of interpreting the object as an instance of 'XMember'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XMember'.
See Also:
doSwitch(EObject)

caseXTypeParameter

public T caseXTypeParameter(XTypeParameter object)
Returns the result of interpreting the object as an instance of 'XType Parameter'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'XType Parameter'.
See Also:
doSwitch(EObject)

defaultCase

public T defaultCase(EObject object)
Returns the result of interpreting the object as an instance of 'EObject'. This implementation returns null; returning a non-null result will terminate the switch, but this is the last case anyway.

Overrides:
defaultCase in class Switch<T>
Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EObject'.
See Also:
Switch.doSwitch(org.eclipse.emf.ecore.EObject)

Copyright 2001-2012 IBM Corporation and others.
All Rights Reserved.