org.eclipse.emf.ecore.util
Class Switch<T>

java.lang.Object
  extended by org.eclipse.emf.ecore.util.Switch<T>
Direct Known Subclasses:
ChangeSwitch, ComposedSwitch, Ecore2EcoreSwitch, Ecore2XMLSwitch, EcoreSwitch, GenModelSwitch, MappingSwitch, TreeSwitch, XcoreSwitch

public abstract class Switch<T>
extends java.lang.Object

An abstract base class for all switch classes.

Since:
2.7

Constructor Summary
Switch()
           
 
Method Summary
 T defaultCase(EObject eObject)
          Returns the result of interpreting the object as an instance of 'EObject'.
protected  T doSwitch(EClass eClass, EObject eObject)
          Calls caseXXX for each (super-)class of the model until one returns a non-null result; it yields that result.
 T doSwitch(EObject eObject)
          Dispatches the target object to the appropriate caseXXX methods.
protected  T doSwitch(int classifierID, EObject eObject)
          Calls caseXXX for each class of the model until one returns a non-null result; it yields that result.
protected abstract  boolean isSwitchFor(EPackage ePackage)
          Indicates whether the receiver is a switch for the specified package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Switch

public Switch()
Method Detail

defaultCase

public T defaultCase(EObject eObject)
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.

Parameters:
eObject - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EObject'.
See Also:
doSwitch(org.eclipse.emf.ecore.EObject)

doSwitch

protected T doSwitch(EClass eClass,
                     EObject eObject)
Calls caseXXX for each (super-)class of the model until one returns a non-null result; it yields that result.

Parameters:
eClass - the class or superclass of eObject to consider. The class's containing EPackage determines whether the receiving switch object can handle the request.
eObject - the model object to pass to the appropriate caseXXX.
Returns:
the first non-null result returned by a caseXXX call.

doSwitch

public T doSwitch(EObject eObject)
Dispatches the target object to the appropriate caseXXX methods.

Parameters:
eObject - the model object to pass to the appropriate caseXXX.
Returns:
the first non-null result returned by a caseXXX call.

doSwitch

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

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

isSwitchFor

protected abstract boolean isSwitchFor(EPackage ePackage)
Indicates whether the receiver is a switch for the specified package.

Parameters:
ePackage - the package of interest.
Returns:
true if the receiver is a switch for package.

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