Skip to content

Package: TaskFactoryImpl

TaskFactoryImpl

nameinstructionbranchcomplexitylinemethod
TaskFactoryImpl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
convertDateOfBirthToString(EDataType, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
convertGenderToString(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%
convertNationalityToString(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: 32 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
create(EClass)
M: 26 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
createDateOfBirthFromString(EDataType, String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createFromString(EDataType, String)
M: 32 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
createGenderFromString(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%
createNationalityFromString(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%
createTask()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createUser()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createUserGroup()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 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%
getTaskPackage()
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: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%

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.makeithappen.model.task.impl;
15:
16: import javax.xml.datatype.XMLGregorianCalendar;
17:
18: import org.eclipse.emf.ecore.EClass;
19: import org.eclipse.emf.ecore.EDataType;
20: import org.eclipse.emf.ecore.EObject;
21: import org.eclipse.emf.ecore.EPackage;
22: import org.eclipse.emf.ecore.impl.EFactoryImpl;
23: import org.eclipse.emf.ecore.plugin.EcorePlugin;
24: import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;
25: import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
26: import org.eclipse.emf.ecp.makeithappen.model.task.Gender;
27: import org.eclipse.emf.ecp.makeithappen.model.task.Nationality;
28: import org.eclipse.emf.ecp.makeithappen.model.task.Task;
29: import org.eclipse.emf.ecp.makeithappen.model.task.TaskFactory;
30: import org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage;
31: import org.eclipse.emf.ecp.makeithappen.model.task.User;
32: import org.eclipse.emf.ecp.makeithappen.model.task.UserGroup;
33:
34: /**
35: * <!-- begin-user-doc -->
36: * An implementation of the model <b>Factory</b>.
37: * <!-- end-user-doc -->
38: *
39: * @generated
40: */
41: public class TaskFactoryImpl extends EFactoryImpl implements TaskFactory {
42:         /**
43:          * Creates the default factory implementation.
44:          * <!-- begin-user-doc -->
45:          * <!-- end-user-doc -->
46:          *
47:          * @generated
48:          */
49:         public static TaskFactory init() {
50:                 try {
51:                         final TaskFactory theTaskFactory = (TaskFactory) EPackage.Registry.INSTANCE
52:                                 .getEFactory(TaskPackage.eNS_URI);
53:                         if (theTaskFactory != null) {
54:•                                return theTaskFactory;
55:                         }
56:                 } catch (final Exception exception) {
57:                         EcorePlugin.INSTANCE.log(exception);
58:                 }
59:                 return new TaskFactoryImpl();
60:         }
61:
62:         /**
63:          * Creates an instance of the factory.
64:          * <!-- begin-user-doc -->
65:          * <!-- end-user-doc -->
66:          *
67:          * @generated
68:          */
69:         public TaskFactoryImpl() {
70:                 super();
71:         }
72:
73:         /**
74:          * <!-- begin-user-doc -->
75:          * <!-- end-user-doc -->
76:          *
77:          * @generated
78:          */
79:         @Override
80:         public EObject create(EClass eClass) {
81:                 switch (eClass.getClassifierID()) {
82:                 case TaskPackage.TASK:
83:                         return createTask();
84:                 case TaskPackage.USER:
85:                         return createUser();
86:•                case TaskPackage.USER_GROUP:
87:                         return createUserGroup();
88:                 default:
89:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
90:                 }
91:         }
92:
93:         /**
94:          * <!-- begin-user-doc -->
95:          * <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         @Override
100:         public Object createFromString(EDataType eDataType, String initialValue) {
101:                 switch (eDataType.getClassifierID()) {
102:                 case TaskPackage.GENDER:
103:                         return createGenderFromString(eDataType, initialValue);
104:                 case TaskPackage.NATIONALITY:
105:                         return createNationalityFromString(eDataType, initialValue);
106:                 case TaskPackage.DATE_OF_BIRTH:
107:                         return createDateOfBirthFromString(eDataType, initialValue);
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:         @Override
120:         public String convertToString(EDataType eDataType, Object instanceValue) {
121:                 switch (eDataType.getClassifierID()) {
122:                 case TaskPackage.GENDER:
123:                         return convertGenderToString(eDataType, instanceValue);
124:                 case TaskPackage.NATIONALITY:
125:                         return convertNationalityToString(eDataType, instanceValue);
126:                 case TaskPackage.DATE_OF_BIRTH:
127:                         return convertDateOfBirthToString(eDataType, instanceValue);
128:                 default:
129:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
130:•                }
131:         }
132:
133:         /**
134:          * <!-- begin-user-doc -->
135:          * <!-- end-user-doc -->
136:          *
137:          * @generated
138:          */
139:         @Override
140:         public Task createTask() {
141:                 final TaskImpl task = new TaskImpl();
142:                 return task;
143:         }
144:
145:         /**
146:          * <!-- begin-user-doc -->
147:          * <!-- end-user-doc -->
148:          *
149:          * @generated
150:          */
151:         @Override
152:         public User createUser() {
153:                 final UserImpl user = new UserImpl();
154:                 return user;
155:         }
156:
157:         /**
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         @Override
164:         public UserGroup createUserGroup() {
165:                 final UserGroupImpl userGroup = new UserGroupImpl();
166:                 return userGroup;
167:         }
168:
169:         /**
170:          * <!-- begin-user-doc -->
171:          * <!-- end-user-doc -->
172:          *
173:          * @generated
174:          */
175:         public Gender createGenderFromString(EDataType eDataType, String initialValue) {
176:                 final Gender result = Gender.get(initialValue);
177:                 if (result == null) {
178:                         throw new IllegalArgumentException(
179:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
180:                 }
181:                 return result;
182:         }
183:
184:         /**
185:          * <!-- begin-user-doc -->
186:          * <!-- end-user-doc -->
187:          *
188:          * @generated
189:          */
190:         public String convertGenderToString(EDataType eDataType, Object instanceValue) {
191:•                return instanceValue == null ? null : instanceValue.toString();
192:         }
193:
194:         /**
195:          * <!-- begin-user-doc -->
196:          * <!-- end-user-doc -->
197:          *
198:          * @generated
199:          */
200:         public Nationality createNationalityFromString(EDataType eDataType, String initialValue) {
201:                 final Nationality result = Nationality.get(initialValue);
202:                 if (result == null) {
203:                         throw new IllegalArgumentException(
204:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
205:                 }
206:                 return result;
207:•        }
208:
209:         /**
210:          * <!-- begin-user-doc -->
211:          * <!-- end-user-doc -->
212:          *
213:          * @generated
214:          */
215:         public String convertNationalityToString(EDataType eDataType, Object instanceValue) {
216:                 return instanceValue == null ? null : instanceValue.toString();
217:         }
218:
219:•        /**
220:          * <!-- begin-user-doc -->
221:          * <!-- end-user-doc -->
222:          *
223:          * @generated
224:          */
225:         public XMLGregorianCalendar createDateOfBirthFromString(EDataType eDataType, String initialValue) {
226:                 return (XMLGregorianCalendar) XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.Literals.DATE,
227:                         initialValue);
228:         }
229:
230:         /**
231:          * <!-- begin-user-doc -->
232:          * <!-- end-user-doc -->
233:          *
234:          * @generated
235:•         */
236:         public String convertDateOfBirthToString(EDataType eDataType, Object instanceValue) {
237:                 return XMLTypeFactory.eINSTANCE.convertToString(XMLTypePackage.Literals.DATE, instanceValue);
238:         }
239:
240:         /**
241:          * <!-- begin-user-doc -->
242:          * <!-- end-user-doc -->
243:          *
244:          * @generated
245:          */
246:         @Override
247:         public TaskPackage getTaskPackage() {
248:                 return (TaskPackage) getEPackage();
249:         }
250:
251:         /**
252:          * <!-- begin-user-doc -->
253:          * <!-- end-user-doc -->
254:          *
255:          * @deprecated
256:          * @generated
257:          */
258:         @Deprecated
259:         public static TaskPackage getPackage() {
260:                 return TaskPackage.eINSTANCE;
261:         }
262:
263: } // TaskFactoryImpl