Skip to content

Package: VLabelFactoryImpl

VLabelFactoryImpl

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