Skip to content

Package: VTTabFactoryImpl

VTTabFactoryImpl

nameinstructionbranchcomplexitylinemethod
VTTabFactoryImpl()
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%
convertTabTypeToString(EDataType, Object)
M: 7 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
convertToString(EDataType, Object)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
create(EClass)
M: 14 C: 6
30%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
createFromString(EDataType, String)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createTabStyleProperty()
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%
createTabTypeFromString(EDataType, String)
M: 25 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
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%
getTabPackage()
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-2016 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 Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.template.style.tab.model.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.view.template.style.tab.model.TabType;
23: import org.eclipse.emf.ecp.view.template.style.tab.model.VTTabFactory;
24: import org.eclipse.emf.ecp.view.template.style.tab.model.VTTabPackage;
25: import org.eclipse.emf.ecp.view.template.style.tab.model.VTTabStyleProperty;
26:
27: /**
28: * <!-- begin-user-doc -->
29: * An implementation of the model <b>Factory</b>.
30: *
31: * @since 1.8
32: * <!-- end-user-doc -->
33: * @generated
34: */
35: public class VTTabFactoryImpl extends EFactoryImpl implements VTTabFactory {
36:         /**
37:          * Creates the default factory implementation.
38:          * <!-- begin-user-doc -->
39:          * <!-- end-user-doc -->
40:          *
41:          * @generated
42:          */
43:         public static VTTabFactory init() {
44:                 try {
45:                         final VTTabFactory theTabFactory = (VTTabFactory) EPackage.Registry.INSTANCE
46:                                 .getEFactory(VTTabPackage.eNS_URI);
47:•                        if (theTabFactory != null) {
48:                                 return theTabFactory;
49:                         }
50:                 } catch (final Exception exception) {
51:                         EcorePlugin.INSTANCE.log(exception);
52:                 }
53:                 return new VTTabFactoryImpl();
54:         }
55:
56:         /**
57:          * Creates an instance of the factory.
58:          * <!-- begin-user-doc -->
59:          * <!-- end-user-doc -->
60:          *
61:          * @generated
62:          */
63:         public VTTabFactoryImpl() {
64:                 super();
65:         }
66:
67:         /**
68:          * <!-- begin-user-doc -->
69:          * <!-- end-user-doc -->
70:          *
71:          * @generated
72:          */
73:         @Override
74:         public EObject create(EClass eClass) {
75:•                switch (eClass.getClassifierID()) {
76:                 case VTTabPackage.TAB_STYLE_PROPERTY:
77:                         return createTabStyleProperty();
78:                 default:
79:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
80:                 }
81:         }
82:
83:         /**
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @generated
88:          */
89:         @Override
90:         public Object createFromString(EDataType eDataType, String initialValue) {
91:•                switch (eDataType.getClassifierID()) {
92:                 case VTTabPackage.TAB_TYPE:
93:                         return createTabTypeFromString(eDataType, initialValue);
94:                 default:
95:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
96:                 }
97:         }
98:
99:         /**
100:          * <!-- begin-user-doc -->
101:          * <!-- end-user-doc -->
102:          *
103:          * @generated
104:          */
105:         @Override
106:         public String convertToString(EDataType eDataType, Object instanceValue) {
107:•                switch (eDataType.getClassifierID()) {
108:                 case VTTabPackage.TAB_TYPE:
109:                         return convertTabTypeToString(eDataType, instanceValue);
110:                 default:
111:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
112:                 }
113:         }
114:
115:         /**
116:          * <!-- begin-user-doc -->
117:          * <!-- end-user-doc -->
118:          *
119:          * @generated
120:          */
121:         @Override
122:         public VTTabStyleProperty createTabStyleProperty() {
123:                 final VTTabStylePropertyImpl tabStyleProperty = new VTTabStylePropertyImpl();
124:                 return tabStyleProperty;
125:         }
126:
127:         /**
128:          * <!-- begin-user-doc -->
129:          * <!-- end-user-doc -->
130:          *
131:          * @generated
132:          */
133:         public TabType createTabTypeFromString(EDataType eDataType, String initialValue) {
134:                 final TabType result = TabType.get(initialValue);
135:•                if (result == null) {
136:                         throw new IllegalArgumentException(
137:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
138:                 }
139:                 return result;
140:         }
141:
142:         /**
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         public String convertTabTypeToString(EDataType eDataType, Object instanceValue) {
149:•                return instanceValue == null ? null : instanceValue.toString();
150:         }
151:
152:         /**
153:          * <!-- begin-user-doc -->
154:          * <!-- end-user-doc -->
155:          *
156:          * @generated
157:          */
158:         @Override
159:         public VTTabPackage getTabPackage() {
160:                 return (VTTabPackage) getEPackage();
161:         }
162:
163:         /**
164:          * <!-- begin-user-doc -->
165:          * <!-- end-user-doc -->
166:          *
167:          * @deprecated
168:          * @generated
169:          */
170:         @Deprecated
171:         public static VTTabPackage getPackage() {
172:                 return VTTabPackage.eINSTANCE;
173:         }
174:
175: } // VTTabFactoryImpl