Skip to content

Package: VTAlignmentFactoryImpl

VTAlignmentFactoryImpl

nameinstructionbranchcomplexitylinemethod
VTAlignmentFactoryImpl()
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%
convertAlignmentTypeToString(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: 9
39%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 1 C: 3
75%
M: 0 C: 1
100%
createAlignmentStyleProperty()
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%
createAlignmentTypeFromString(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%
createControlLabelAlignmentStyleProperty()
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%
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%
getAlignmentPackage()
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-2014 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.alignment.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.alignment.model.AlignmentType;
23: import org.eclipse.emf.ecp.view.template.style.alignment.model.VTAlignmentFactory;
24: import org.eclipse.emf.ecp.view.template.style.alignment.model.VTAlignmentPackage;
25: import org.eclipse.emf.ecp.view.template.style.alignment.model.VTAlignmentStyleProperty;
26: import org.eclipse.emf.ecp.view.template.style.alignment.model.VTControlLabelAlignmentStyleProperty;
27:
28: /**
29: * <!-- begin-user-doc -->
30: * An implementation of the model <b>Factory</b>.
31: * <!-- end-user-doc -->
32: *
33: * @generated
34: */
35: public class VTAlignmentFactoryImpl extends EFactoryImpl implements VTAlignmentFactory {
36:         /**
37:          * Creates the default factory implementation.
38:          * <!-- begin-user-doc -->
39:          * <!-- end-user-doc -->
40:          *
41:          * @generated
42:          */
43:         public static VTAlignmentFactory init() {
44:                 try {
45:                         final VTAlignmentFactory theAlignmentFactory = (VTAlignmentFactory) EPackage.Registry.INSTANCE
46:                                 .getEFactory(VTAlignmentPackage.eNS_URI);
47:•                        if (theAlignmentFactory != null) {
48:                                 return theAlignmentFactory;
49:                         }
50:                 } catch (final Exception exception) {
51:                         EcorePlugin.INSTANCE.log(exception);
52:                 }
53:                 return new VTAlignmentFactoryImpl();
54:         }
55:
56:         /**
57:          * Creates an instance of the factory.
58:          * <!-- begin-user-doc -->
59:          * <!-- end-user-doc -->
60:          *
61:          * @generated
62:          */
63:         public VTAlignmentFactoryImpl() {
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 VTAlignmentPackage.ALIGNMENT_STYLE_PROPERTY:
77:                         return createAlignmentStyleProperty();
78:                 case VTAlignmentPackage.CONTROL_LABEL_ALIGNMENT_STYLE_PROPERTY:
79:                         return createControlLabelAlignmentStyleProperty();
80:                 default:
81:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
82:                 }
83:         }
84:
85:         /**
86:          * <!-- begin-user-doc -->
87:          * <!-- end-user-doc -->
88:          *
89:          * @generated
90:          */
91:         @Override
92:         public Object createFromString(EDataType eDataType, String initialValue) {
93:•                switch (eDataType.getClassifierID()) {
94:                 case VTAlignmentPackage.ALIGNMENT_TYPE:
95:                         return createAlignmentTypeFromString(eDataType, initialValue);
96:                 default:
97:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
98:                 }
99:         }
100:
101:         /**
102:          * <!-- begin-user-doc -->
103:          * <!-- end-user-doc -->
104:          *
105:          * @generated
106:          */
107:         @Override
108:         public String convertToString(EDataType eDataType, Object instanceValue) {
109:•                switch (eDataType.getClassifierID()) {
110:                 case VTAlignmentPackage.ALIGNMENT_TYPE:
111:                         return convertAlignmentTypeToString(eDataType, instanceValue);
112:                 default:
113:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
114:                 }
115:         }
116:
117:         /**
118:          * <!-- begin-user-doc -->
119:          * <!-- end-user-doc -->
120:          *
121:          * @generated
122:          */
123:         @Override
124:         public VTAlignmentStyleProperty createAlignmentStyleProperty() {
125:                 final VTAlignmentStylePropertyImpl alignmentStyleProperty = new VTAlignmentStylePropertyImpl();
126:                 return alignmentStyleProperty;
127:         }
128:
129:         /**
130:          * <!-- begin-user-doc -->
131:          * <!-- end-user-doc -->
132:          *
133:          * @generated
134:          */
135:         @Override
136:         public VTControlLabelAlignmentStyleProperty createControlLabelAlignmentStyleProperty() {
137:                 final VTControlLabelAlignmentStylePropertyImpl controlLabelAlignmentStyleProperty = new VTControlLabelAlignmentStylePropertyImpl();
138:                 return controlLabelAlignmentStyleProperty;
139:         }
140:
141:         /**
142:          * <!-- begin-user-doc -->
143:          * <!-- end-user-doc -->
144:          *
145:          * @generated
146:          */
147:         public AlignmentType createAlignmentTypeFromString(EDataType eDataType, String initialValue) {
148:                 final AlignmentType result = AlignmentType.get(initialValue);
149:•                if (result == null) {
150:                         throw new IllegalArgumentException(
151:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
152:                 }
153:                 return result;
154:         }
155:
156:         /**
157:          * <!-- begin-user-doc -->
158:          * <!-- end-user-doc -->
159:          *
160:          * @generated
161:          */
162:         public String convertAlignmentTypeToString(EDataType eDataType, Object instanceValue) {
163:•                return instanceValue == null ? null : instanceValue.toString();
164:         }
165:
166:         /**
167:          * <!-- begin-user-doc -->
168:          * <!-- end-user-doc -->
169:          *
170:          * @generated
171:          */
172:         @Override
173:         public VTAlignmentPackage getAlignmentPackage() {
174:                 return (VTAlignmentPackage) getEPackage();
175:         }
176:
177:         /**
178:          * <!-- begin-user-doc -->
179:          * <!-- end-user-doc -->
180:          *
181:          * @deprecated
182:          * @generated
183:          */
184:         @Deprecated
185:         public static VTAlignmentPackage getPackage() {
186:                 return VTAlignmentPackage.eINSTANCE;
187:         }
188:
189: } // VTAlignmentFactoryImpl