Skip to content

Package: TestDataFactoryImpl

TestDataFactoryImpl

nameinstructionbranchcomplexitylinemethod
TestDataFactoryImpl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
convertStringWithMaxLength8ToString(EDataType, Object)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
convertToString(EDataType, Object)
M: 14 C: 8
36%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
create(EClass)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createFromString(EDataType, String)
M: 14 C: 8
36%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
createStringWithMaxLength8FromString(EDataType, String)
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%
createTestData()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getPackage()
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%
getTestDataPackage()
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%
init()
M: 6 C: 11
65%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 3 C: 4
57%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2018 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: * EclipseSource Muenchen GmbH - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.edit.internal.model.testData.impl;
15:
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecore.EDataType;
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecore.EPackage;
20: import org.eclipse.emf.ecore.impl.EFactoryImpl;
21: import org.eclipse.emf.ecore.plugin.EcorePlugin;
22: import org.eclipse.emf.ecp.edit.internal.model.testData.TestData;
23: import org.eclipse.emf.ecp.edit.internal.model.testData.TestDataFactory;
24: import org.eclipse.emf.ecp.edit.internal.model.testData.TestDataPackage;
25:
26: /**
27: * <!-- begin-user-doc -->
28: * An implementation of the model <b>Factory</b>.
29: * <!-- end-user-doc -->
30: *
31: * @generated
32: */
33: public class TestDataFactoryImpl extends EFactoryImpl implements TestDataFactory {
34:         /**
35:          * Creates the default factory implementation.
36:          * <!-- begin-user-doc -->
37:          * <!-- end-user-doc -->
38:          *
39:          * @generated
40:          */
41:         public static TestDataFactory init() {
42:                 try {
43:                         final TestDataFactory theTestDataFactory = (TestDataFactory) EPackage.Registry.INSTANCE
44:                                 .getEFactory(TestDataPackage.eNS_URI);
45:•                        if (theTestDataFactory != null) {
46:                                 return theTestDataFactory;
47:                         }
48:                 } catch (final Exception exception) {
49:                         EcorePlugin.INSTANCE.log(exception);
50:                 }
51:                 return new TestDataFactoryImpl();
52:         }
53:
54:         /**
55:          * Creates an instance of the factory.
56:          * <!-- begin-user-doc -->
57:          * <!-- end-user-doc -->
58:          *
59:          * @generated
60:          */
61:         public TestDataFactoryImpl() {
62:                 super();
63:         }
64:
65:         /**
66:          * <!-- begin-user-doc -->
67:          * <!-- end-user-doc -->
68:          *
69:          * @generated
70:          */
71:         @Override
72:         public EObject create(EClass eClass) {
73:•                switch (eClass.getClassifierID()) {
74:                 case TestDataPackage.TEST_DATA:
75:                         return createTestData();
76:                 default:
77:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
78:                 }
79:         }
80:
81:         /**
82:          * <!-- begin-user-doc -->
83:          * <!-- end-user-doc -->
84:          *
85:          * @generated
86:          */
87:         @Override
88:         public Object createFromString(EDataType eDataType, String initialValue) {
89:•                switch (eDataType.getClassifierID()) {
90:                 case TestDataPackage.STRING_WITH_MAX_LENGTH8:
91:                         return createStringWithMaxLength8FromString(eDataType, initialValue);
92:                 default:
93:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
94:                 }
95:         }
96:
97:         /**
98:          * <!-- begin-user-doc -->
99:          * <!-- end-user-doc -->
100:          *
101:          * @generated
102:          */
103:         @Override
104:         public String convertToString(EDataType eDataType, Object instanceValue) {
105:•                switch (eDataType.getClassifierID()) {
106:                 case TestDataPackage.STRING_WITH_MAX_LENGTH8:
107:                         return convertStringWithMaxLength8ToString(eDataType, instanceValue);
108:                 default:
109:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
110:                 }
111:         }
112:
113:         /**
114:          * <!-- begin-user-doc -->
115:          * <!-- end-user-doc -->
116:          *
117:          * @generated
118:          */
119:         public TestData createTestData() {
120:                 final TestDataImpl testData = new TestDataImpl();
121:                 return testData;
122:         }
123:
124:         /**
125:          * <!-- begin-user-doc -->
126:          * <!-- end-user-doc -->
127:          *
128:          * @generated
129:          */
130:         public String createStringWithMaxLength8FromString(EDataType eDataType, String initialValue) {
131:                 return (String) super.createFromString(eDataType, initialValue);
132:         }
133:
134:         /**
135:          * <!-- begin-user-doc -->
136:          * <!-- end-user-doc -->
137:          *
138:          * @generated
139:          */
140:         public String convertStringWithMaxLength8ToString(EDataType eDataType, Object instanceValue) {
141:                 return super.convertToString(eDataType, instanceValue);
142:         }
143:
144:         /**
145:          * <!-- begin-user-doc -->
146:          * <!-- end-user-doc -->
147:          *
148:          * @generated
149:          */
150:         public TestDataPackage getTestDataPackage() {
151:                 return (TestDataPackage) getEPackage();
152:         }
153:
154:         /**
155:          * <!-- begin-user-doc -->
156:          * <!-- end-user-doc -->
157:          *
158:          * @deprecated
159:          * @generated
160:          */
161:         @Deprecated
162:         public static TestDataPackage getPackage() {
163:                 return TestDataPackage.eINSTANCE;
164:         }
165:
166: } // TestDataFactoryImpl