Skip to content

Package: TestAdapterFactory

TestAdapterFactory

nameinstructionbranchcomplexitylinemethod
TestAdapterFactory()
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
createAdapter(Notifier)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createBookAdapter()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createEObjectAdapter()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createLibraryAdapter()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createWriterAdapter()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isFactoryForType(Object)
M: 20 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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: * Johannes Faltermeier
14: *
15: *******************************************************************************/
16: package org.eclipse.emf.ecp.validation.test.test.util;
17:
18: import org.eclipse.emf.common.notify.Adapter;
19: import org.eclipse.emf.common.notify.Notifier;
20: import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
21: import org.eclipse.emf.ecore.EObject;
22: import org.eclipse.emf.ecp.validation.test.test.Book;
23: import org.eclipse.emf.ecp.validation.test.test.Library;
24: import org.eclipse.emf.ecp.validation.test.test.TestPackage;
25: import org.eclipse.emf.ecp.validation.test.test.Writer;
26:
27: /**
28: * <!-- begin-user-doc -->
29: * The <b>Adapter Factory</b> for the model.
30: * It provides an adapter <code>createXXX</code> method for each class of the model.
31: * <!-- end-user-doc -->
32: *
33: * @see org.eclipse.emf.ecp.validation.test.test.TestPackage
34: * @generated
35: */
36: public class TestAdapterFactory extends AdapterFactoryImpl {
37:         /**
38:          * The cached model package.
39:          * <!-- begin-user-doc -->
40:          * <!-- end-user-doc -->
41:          *
42:          * @generated
43:          */
44:         protected static TestPackage modelPackage;
45:
46:         /**
47:          * Creates an instance of the adapter factory.
48:          * <!-- begin-user-doc -->
49:          * <!-- end-user-doc -->
50:          *
51:          * @generated
52:          */
53:         public TestAdapterFactory() {
54:•                if (modelPackage == null) {
55:                         modelPackage = TestPackage.eINSTANCE;
56:                 }
57:         }
58:
59:         /**
60:          * Returns whether this factory is applicable for the type of the object.
61:          * <!-- begin-user-doc -->
62:          * This implementation returns <code>true</code> if the object is either the model's package or is an instance
63:          * object of the model.
64:          * <!-- end-user-doc -->
65:          *
66:          * @return whether this factory is applicable for the type of the object.
67:          * @generated
68:          */
69:         @Override
70:         public boolean isFactoryForType(Object object) {
71:•                if (object == modelPackage) {
72:                         return true;
73:                 }
74:•                if (object instanceof EObject) {
75:•                        return ((EObject) object).eClass().getEPackage() == modelPackage;
76:                 }
77:                 return false;
78:         }
79:
80:         /**
81:          * The switch that delegates to the <code>createXXX</code> methods.
82:          * <!-- begin-user-doc -->
83:          * <!-- end-user-doc -->
84:          *
85:          * @generated
86:          */
87:         protected TestSwitch<Adapter> modelSwitch = new TestSwitch<Adapter>() {
88:                 @Override
89:                 public Adapter caseLibrary(Library object) {
90:                         return createLibraryAdapter();
91:                 }
92:
93:                 @Override
94:                 public Adapter caseWriter(Writer object) {
95:                         return createWriterAdapter();
96:                 }
97:
98:                 @Override
99:                 public Adapter caseBook(Book object) {
100:                         return createBookAdapter();
101:                 }
102:
103:                 @Override
104:                 public Adapter defaultCase(EObject object) {
105:                         return createEObjectAdapter();
106:                 }
107:         };
108:
109:         /**
110:          * Creates an adapter for the <code>target</code>.
111:          * <!-- begin-user-doc -->
112:          * <!-- end-user-doc -->
113:          *
114:          * @param target the object to adapt.
115:          * @return the adapter for the <code>target</code>.
116:          * @generated
117:          */
118:         @Override
119:         public Adapter createAdapter(Notifier target) {
120:                 return modelSwitch.doSwitch((EObject) target);
121:         }
122:
123:         /**
124:          * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecp.validation.test.test.Library
125:          * <em>Library</em>}'.
126:          * <!-- begin-user-doc -->
127:          * This default implementation returns null so that we can easily ignore cases;
128:          * it's useful to ignore a case when inheritance will catch all the cases anyway.
129:          * <!-- end-user-doc -->
130:          *
131:          * @return the new adapter.
132:          * @see org.eclipse.emf.ecp.validation.test.test.Library
133:          * @generated
134:          */
135:         public Adapter createLibraryAdapter() {
136:                 return null;
137:         }
138:
139:         /**
140:          * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecp.validation.test.test.Writer
141:          * <em>Writer</em>}'.
142:          * <!-- begin-user-doc -->
143:          * This default implementation returns null so that we can easily ignore cases;
144:          * it's useful to ignore a case when inheritance will catch all the cases anyway.
145:          * <!-- end-user-doc -->
146:          *
147:          * @return the new adapter.
148:          * @see org.eclipse.emf.ecp.validation.test.test.Writer
149:          * @generated
150:          */
151:         public Adapter createWriterAdapter() {
152:                 return null;
153:         }
154:
155:         /**
156:          * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecp.validation.test.test.Book <em>Book</em>}
157:          * '.
158:          * <!-- begin-user-doc -->
159:          * This default implementation returns null so that we can easily ignore cases;
160:          * it's useful to ignore a case when inheritance will catch all the cases anyway.
161:          * <!-- end-user-doc -->
162:          *
163:          * @return the new adapter.
164:          * @see org.eclipse.emf.ecp.validation.test.test.Book
165:          * @generated
166:          */
167:         public Adapter createBookAdapter() {
168:                 return null;
169:         }
170:
171:         /**
172:          * Creates a new adapter for the default case.
173:          * <!-- begin-user-doc -->
174:          * This default implementation returns null.
175:          * <!-- end-user-doc -->
176:          *
177:          * @return the new adapter.
178:          * @generated
179:          */
180:         public Adapter createEObjectAdapter() {
181:                 return null;
182:         }
183:
184: } // TestAdapterFactory