Skip to content

Package: TestAdapterFactory$1

TestAdapterFactory$1

nameinstructionbranchcomplexitylinemethod
caseInnerObject(InnerObject)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
caseSimpleTestObject(SimpleTestObject)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultCase(EObject)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
{...}
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen Neufeld - initial API and implementation
13: * Lucas Koehler - extension for EnumComboViewerRenderer_PTest
14: */
15: package org.eclipse.emf.ecp.view.core.swt.test.model.util;
16:
17: import org.eclipse.emf.common.notify.Adapter;
18: import org.eclipse.emf.common.notify.Notifier;
19: import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
20: import org.eclipse.emf.ecore.EObject;
21: import org.eclipse.emf.ecp.view.core.swt.test.model.InnerObject;
22: import org.eclipse.emf.ecp.view.core.swt.test.model.SimpleTestObject;
23: import org.eclipse.emf.ecp.view.core.swt.test.model.TestPackage;
24:
25: /**
26: * <!-- begin-user-doc -->
27: * The <b>Adapter Factory</b> for the model.
28: * It provides an adapter <code>createXXX</code> method for each class of the model.
29: * <!-- end-user-doc -->
30: *
31: * @see org.eclipse.emf.ecp.view.core.swt.test.model.TestPackage
32: * @generated
33: */
34: public class TestAdapterFactory extends AdapterFactoryImpl {
35:         /**
36:          * The cached model package.
37:          * <!-- begin-user-doc -->
38:          * <!-- end-user-doc -->
39:          *
40:          * @generated
41:          */
42:         protected static TestPackage modelPackage;
43:
44:         /**
45:          * Creates an instance of the adapter factory.
46:          * <!-- begin-user-doc -->
47:          * <!-- end-user-doc -->
48:          *
49:          * @generated
50:          */
51:         public TestAdapterFactory() {
52:                 if (modelPackage == null) {
53:                         modelPackage = TestPackage.eINSTANCE;
54:                 }
55:         }
56:
57:         /**
58:          * Returns whether this factory is applicable for the type of the object.
59:          * <!-- begin-user-doc -->
60:          * This implementation returns <code>true</code> if the object is either the model's package or is an instance
61:          * object of the model.
62:          * <!-- end-user-doc -->
63:          *
64:          * @return whether this factory is applicable for the type of the object.
65:          * @generated
66:          */
67:         @Override
68:         public boolean isFactoryForType(Object object) {
69:                 if (object == modelPackage) {
70:                         return true;
71:                 }
72:                 if (object instanceof EObject) {
73:                         return ((EObject) object).eClass().getEPackage() == modelPackage;
74:                 }
75:                 return false;
76:         }
77:
78:         /**
79:          * The switch that delegates to the <code>createXXX</code> methods.
80:          * <!-- begin-user-doc -->
81:          * <!-- end-user-doc -->
82:          *
83:          * @generated
84:          */
85:         protected TestSwitch<Adapter> modelSwitch = new TestSwitch<Adapter>() {
86:                 @Override
87:                 public Adapter caseSimpleTestObject(SimpleTestObject object) {
88:                         return createSimpleTestObjectAdapter();
89:                 }
90:
91:                 @Override
92:                 public Adapter caseInnerObject(InnerObject object) {
93:                         return createInnerObjectAdapter();
94:                 }
95:
96:                 @Override
97:                 public Adapter defaultCase(EObject object) {
98:                         return createEObjectAdapter();
99:                 }
100:         };
101:
102:         /**
103:          * Creates an adapter for the <code>target</code>.
104:          * <!-- begin-user-doc -->
105:          * <!-- end-user-doc -->
106:          *
107:          * @param target the object to adapt.
108:          * @return the adapter for the <code>target</code>.
109:          * @generated
110:          */
111:         @Override
112:         public Adapter createAdapter(Notifier target) {
113:                 return modelSwitch.doSwitch((EObject) target);
114:         }
115:
116:         /**
117:          * Creates a new adapter for an object of class
118:          * '{@link org.eclipse.emf.ecp.view.core.swt.test.model.SimpleTestObject <em>Simple Test Object</em>}'.
119:          * <!-- begin-user-doc -->
120:          * This default implementation returns null so that we can easily ignore cases;
121:          * it's useful to ignore a case when inheritance will catch all the cases anyway.
122:          * <!-- end-user-doc -->
123:          *
124:          * @return the new adapter.
125:          * @see org.eclipse.emf.ecp.view.core.swt.test.model.SimpleTestObject
126:          * @generated
127:          */
128:         public Adapter createSimpleTestObjectAdapter() {
129:                 return null;
130:         }
131:
132:         /**
133:          * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecp.view.core.swt.test.model.InnerObject
134:          * <em>Inner Object</em>}'.
135:          * <!-- begin-user-doc -->
136:          * This default implementation returns null so that we can easily ignore cases;
137:          * it's useful to ignore a case when inheritance will catch all the cases anyway.
138:          * <!-- end-user-doc -->
139:          *
140:          * @return the new adapter.
141:          * @see org.eclipse.emf.ecp.view.core.swt.test.model.InnerObject
142:          * @generated
143:          */
144:         public Adapter createInnerObjectAdapter() {
145:                 return null;
146:         }
147:
148:         /**
149:          * Creates a new adapter for the default case.
150:          * <!-- begin-user-doc -->
151:          * This default implementation returns null.
152:          * <!-- end-user-doc -->
153:          *
154:          * @return the new adapter.
155:          * @generated
156:          */
157:         public Adapter createEObjectAdapter() {
158:                 return null;
159:         }
160:
161: } // TestAdapterFactory