public class ComposedSwitch<T> extends Switch<T>
Constructor and Description |
---|
ComposedSwitch()
Creates a new ComposedSwitch.
|
ComposedSwitch(java.util.Collection<? extends Switch<T>> switches)
Creates a new ComposedSwitch.
|
Modifier and Type | Method and Description |
---|---|
void |
addSwitch(Switch<T> sw) |
protected T |
delegatedDoSwitch(Switch<T> delegate,
EClass theEClass,
EObject theEObject)
Call delegate.
|
protected T |
doSwitch(EClass theEClass,
EObject theEObject)
Calls
caseXXX for each (super-)class of the model until one returns a non-null result;
it yields that result. |
protected Switch<T> |
findDelegate(EPackage ePackage)
Finds a suitable delegate for the given package.
|
boolean |
isSwitchFor(EPackage ePackage)
Indicates whether the receiver is a switch for the specified package.
|
void |
removeSwitch(Switch<T> sw) |
defaultCase, doSwitch, doSwitch
public ComposedSwitch()
public ComposedSwitch(java.util.Collection<? extends Switch<T>> switches)
switches
- The switches to which the composed switch will delegate. The list should generally include switches for all the
packages the composed switch will be expected to handle.protected T doSwitch(EClass theEClass, EObject theEObject)
Switch
caseXXX
for each (super-)class of the model until one returns a non-null result;
it yields that result.doSwitch
in class Switch<T>
theEClass
- the class or superclass of eObject
to consider.
The class's containing EPackage
determines whether the receiving switch object can handle the request.theEObject
- the model object to pass to the appropriate caseXXX
.caseXXX
call.protected T delegatedDoSwitch(Switch<T> delegate, EClass theEClass, EObject theEObject)
doSwitch
(theEClass, theEObject).protected Switch<T> findDelegate(EPackage ePackage)
public boolean isSwitchFor(EPackage ePackage)
Switch
isSwitchFor
in class Switch<T>
ePackage
- the package of interest.true
if the receiver is a switch for package
.