| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package EMOF.impl; |
| 8 | |
| 9 | import EMOF.Comment; |
| 10 | import EMOF.DataType; |
| 11 | import EMOF.EMOFFactory; |
| 12 | import EMOF.EMOFPackage; |
| 13 | import EMOF.Enumeration; |
| 14 | import EMOF.EnumerationLiteral; |
| 15 | import EMOF.Extent; |
| 16 | import EMOF.Factory; |
| 17 | import EMOF.Operation; |
| 18 | import EMOF.Parameter; |
| 19 | import EMOF.PrimitiveType; |
| 20 | import EMOF.Property; |
| 21 | import EMOF.ReflectiveCollection; |
| 22 | import EMOF.ReflectiveSequence; |
| 23 | import EMOF.Tag; |
| 24 | import EMOF.URIExtent; |
| 25 | |
| 26 | import org.eclipse.emf.ecore.EClass; |
| 27 | import org.eclipse.emf.ecore.EDataType; |
| 28 | import org.eclipse.emf.ecore.EObject; |
| 29 | import org.eclipse.emf.ecore.EPackage; |
| 30 | |
| 31 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
| 32 | |
| 33 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| 34 | |
| 35 | /** |
| 36 | * <!-- begin-user-doc --> |
| 37 | * An implementation of the model <b>Factory</b>. |
| 38 | * <!-- end-user-doc --> |
| 39 | * @generated |
| 40 | */ |
| 41 | public class EMOFFactoryImpl extends EFactoryImpl implements EMOFFactory { |
| 42 | /** |
| 43 | * Creates the default factory implementation. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @generated |
| 47 | */ |
| 48 | public static EMOFFactory init() { |
| 49 | try { |
| 50 | EMOFFactory theEMOFFactory = (EMOFFactory)EPackage.Registry.INSTANCE.getEFactory("http://schema.omg.org/spec/MOF/2.0/emof.xml"); |
| 51 | if (theEMOFFactory != null) { |
| 52 | return theEMOFFactory; |
| 53 | } |
| 54 | } |
| 55 | catch (Exception exception) { |
| 56 | EcorePlugin.INSTANCE.log(exception); |
| 57 | } |
| 58 | return new EMOFFactoryImpl(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Creates an instance of the factory. |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @generated |
| 66 | */ |
| 67 | public EMOFFactoryImpl() { |
| 68 | super(); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | @Override |
| 77 | public EObject create(EClass eClass) { |
| 78 | switch (eClass.getClassifierID()) { |
| 79 | case EMOFPackage.CLASS: return createClass(); |
| 80 | case EMOFPackage.COMMENT: return createComment(); |
| 81 | case EMOFPackage.DATA_TYPE: return createDataType(); |
| 82 | case EMOFPackage.ENUMERATION: return createEnumeration(); |
| 83 | case EMOFPackage.ENUMERATION_LITERAL: return createEnumerationLiteral(); |
| 84 | case EMOFPackage.EXTENT: return createExtent(); |
| 85 | case EMOFPackage.FACTORY: return createFactory(); |
| 86 | case EMOFPackage.OBJECT: return createObject(); |
| 87 | case EMOFPackage.OPERATION: return createOperation(); |
| 88 | case EMOFPackage.PACKAGE: return createPackage(); |
| 89 | case EMOFPackage.PARAMETER: return createParameter(); |
| 90 | case EMOFPackage.PRIMITIVE_TYPE: return createPrimitiveType(); |
| 91 | case EMOFPackage.PROPERTY: return createProperty(); |
| 92 | case EMOFPackage.REFLECTIVE_COLLECTION: return createReflectiveCollection(); |
| 93 | case EMOFPackage.REFLECTIVE_SEQUENCE: return createReflectiveSequence(); |
| 94 | case EMOFPackage.TAG: return createTag(); |
| 95 | case EMOFPackage.URI_EXTENT: return createURIExtent(); |
| 96 | default: |
| 97 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @generated |
| 105 | */ |
| 106 | @Override |
| 107 | public Object createFromString(EDataType eDataType, String initialValue) { |
| 108 | switch (eDataType.getClassifierID()) { |
| 109 | case EMOFPackage.BOOLEAN: |
| 110 | return createBooleanFromString(eDataType, initialValue); |
| 111 | case EMOFPackage.INTEGER: |
| 112 | return createIntegerFromString(eDataType, initialValue); |
| 113 | case EMOFPackage.REAL: |
| 114 | return createRealFromString(eDataType, initialValue); |
| 115 | case EMOFPackage.STRING: |
| 116 | return createStringFromString(eDataType, initialValue); |
| 117 | case EMOFPackage.UNLIMITED_NATURAL: |
| 118 | return createUnlimitedNaturalFromString(eDataType, initialValue); |
| 119 | default: |
| 120 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @generated |
| 128 | */ |
| 129 | @Override |
| 130 | public String convertToString(EDataType eDataType, Object instanceValue) { |
| 131 | switch (eDataType.getClassifierID()) { |
| 132 | case EMOFPackage.BOOLEAN: |
| 133 | return convertBooleanToString(eDataType, instanceValue); |
| 134 | case EMOFPackage.INTEGER: |
| 135 | return convertIntegerToString(eDataType, instanceValue); |
| 136 | case EMOFPackage.REAL: |
| 137 | return convertRealToString(eDataType, instanceValue); |
| 138 | case EMOFPackage.STRING: |
| 139 | return convertStringToString(eDataType, instanceValue); |
| 140 | case EMOFPackage.UNLIMITED_NATURAL: |
| 141 | return convertUnlimitedNaturalToString(eDataType, instanceValue); |
| 142 | default: |
| 143 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * <!-- begin-user-doc --> |
| 149 | * <!-- end-user-doc --> |
| 150 | * @generated |
| 151 | */ |
| 152 | public EMOF.Class createClass() { |
| 153 | ClassImpl class_ = new ClassImpl(); |
| 154 | return class_; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * <!-- begin-user-doc --> |
| 159 | * <!-- end-user-doc --> |
| 160 | * @generated |
| 161 | */ |
| 162 | public Comment createComment() { |
| 163 | CommentImpl comment = new CommentImpl(); |
| 164 | return comment; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * <!-- begin-user-doc --> |
| 169 | * <!-- end-user-doc --> |
| 170 | * @generated |
| 171 | */ |
| 172 | public DataType createDataType() { |
| 173 | DataTypeImpl dataType = new DataTypeImpl(); |
| 174 | return dataType; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | public Enumeration createEnumeration() { |
| 183 | EnumerationImpl enumeration = new EnumerationImpl(); |
| 184 | return enumeration; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * <!-- begin-user-doc --> |
| 189 | * <!-- end-user-doc --> |
| 190 | * @generated |
| 191 | */ |
| 192 | public EnumerationLiteral createEnumerationLiteral() { |
| 193 | EnumerationLiteralImpl enumerationLiteral = new EnumerationLiteralImpl(); |
| 194 | return enumerationLiteral; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * <!-- begin-user-doc --> |
| 199 | * <!-- end-user-doc --> |
| 200 | * @generated |
| 201 | */ |
| 202 | public Extent createExtent() { |
| 203 | ExtentImpl extent = new ExtentImpl(); |
| 204 | return extent; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * <!-- begin-user-doc --> |
| 209 | * <!-- end-user-doc --> |
| 210 | * @generated |
| 211 | */ |
| 212 | public Factory createFactory() { |
| 213 | FactoryImpl factory = new FactoryImpl(); |
| 214 | return factory; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * <!-- begin-user-doc --> |
| 219 | * <!-- end-user-doc --> |
| 220 | * @generated |
| 221 | */ |
| 222 | public EMOF.Object createObject() { |
| 223 | ObjectImpl object = new ObjectImpl(); |
| 224 | return object; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * <!-- begin-user-doc --> |
| 229 | * <!-- end-user-doc --> |
| 230 | * @generated |
| 231 | */ |
| 232 | public Operation createOperation() { |
| 233 | OperationImpl operation = new OperationImpl(); |
| 234 | return operation; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * <!-- begin-user-doc --> |
| 239 | * <!-- end-user-doc --> |
| 240 | * @generated |
| 241 | */ |
| 242 | public EMOF.Package createPackage() { |
| 243 | PackageImpl package_ = new PackageImpl(); |
| 244 | return package_; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * <!-- begin-user-doc --> |
| 249 | * <!-- end-user-doc --> |
| 250 | * @generated |
| 251 | */ |
| 252 | public Parameter createParameter() { |
| 253 | ParameterImpl parameter = new ParameterImpl(); |
| 254 | return parameter; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * <!-- begin-user-doc --> |
| 259 | * <!-- end-user-doc --> |
| 260 | * @generated |
| 261 | */ |
| 262 | public PrimitiveType createPrimitiveType() { |
| 263 | PrimitiveTypeImpl primitiveType = new PrimitiveTypeImpl(); |
| 264 | return primitiveType; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * <!-- begin-user-doc --> |
| 269 | * <!-- end-user-doc --> |
| 270 | * @generated |
| 271 | */ |
| 272 | public Property createProperty() { |
| 273 | PropertyImpl property = new PropertyImpl(); |
| 274 | return property; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * <!-- begin-user-doc --> |
| 279 | * <!-- end-user-doc --> |
| 280 | * @generated |
| 281 | */ |
| 282 | public ReflectiveCollection createReflectiveCollection() { |
| 283 | ReflectiveCollectionImpl reflectiveCollection = new ReflectiveCollectionImpl(); |
| 284 | return reflectiveCollection; |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * <!-- begin-user-doc --> |
| 289 | * <!-- end-user-doc --> |
| 290 | * @generated |
| 291 | */ |
| 292 | public ReflectiveSequence createReflectiveSequence() { |
| 293 | ReflectiveSequenceImpl reflectiveSequence = new ReflectiveSequenceImpl(); |
| 294 | return reflectiveSequence; |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * <!-- begin-user-doc --> |
| 299 | * <!-- end-user-doc --> |
| 300 | * @generated |
| 301 | */ |
| 302 | public Tag createTag() { |
| 303 | TagImpl tag = new TagImpl(); |
| 304 | return tag; |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * <!-- begin-user-doc --> |
| 309 | * <!-- end-user-doc --> |
| 310 | * @generated |
| 311 | */ |
| 312 | public URIExtent createURIExtent() { |
| 313 | URIExtentImpl uriExtent = new URIExtentImpl(); |
| 314 | return uriExtent; |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * <!-- begin-user-doc --> |
| 319 | * <!-- end-user-doc --> |
| 320 | * @generated |
| 321 | */ |
| 322 | public Boolean createBooleanFromString(EDataType eDataType, String initialValue) { |
| 323 | return (Boolean)super.createFromString(eDataType, initialValue); |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * <!-- begin-user-doc --> |
| 328 | * <!-- end-user-doc --> |
| 329 | * @generated |
| 330 | */ |
| 331 | public String convertBooleanToString(EDataType eDataType, Object instanceValue) { |
| 332 | return super.convertToString(eDataType, instanceValue); |
| 333 | } |
| 334 | |
| 335 | /** |
| 336 | * <!-- begin-user-doc --> |
| 337 | * <!-- end-user-doc --> |
| 338 | * @generated |
| 339 | */ |
| 340 | public Integer createIntegerFromString(EDataType eDataType, String initialValue) { |
| 341 | return (Integer)super.createFromString(eDataType, initialValue); |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * <!-- begin-user-doc --> |
| 346 | * <!-- end-user-doc --> |
| 347 | * @generated |
| 348 | */ |
| 349 | public String convertIntegerToString(EDataType eDataType, Object instanceValue) { |
| 350 | return super.convertToString(eDataType, instanceValue); |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * <!-- begin-user-doc --> |
| 355 | * <!-- end-user-doc --> |
| 356 | * @generated |
| 357 | */ |
| 358 | public Float createRealFromString(EDataType eDataType, String initialValue) { |
| 359 | return (Float)super.createFromString(eDataType, initialValue); |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * <!-- begin-user-doc --> |
| 364 | * <!-- end-user-doc --> |
| 365 | * @generated |
| 366 | */ |
| 367 | public String convertRealToString(EDataType eDataType, Object instanceValue) { |
| 368 | return super.convertToString(eDataType, instanceValue); |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * <!-- begin-user-doc --> |
| 373 | * <!-- end-user-doc --> |
| 374 | * @generated |
| 375 | */ |
| 376 | public String createStringFromString(EDataType eDataType, String initialValue) { |
| 377 | return (String)super.createFromString(eDataType, initialValue); |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * <!-- begin-user-doc --> |
| 382 | * <!-- end-user-doc --> |
| 383 | * @generated |
| 384 | */ |
| 385 | public String convertStringToString(EDataType eDataType, Object instanceValue) { |
| 386 | return super.convertToString(eDataType, instanceValue); |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * <!-- begin-user-doc --> |
| 391 | * <!-- end-user-doc --> |
| 392 | * @generated |
| 393 | */ |
| 394 | public Integer createUnlimitedNaturalFromString(EDataType eDataType, String initialValue) { |
| 395 | return (Integer)super.createFromString(eDataType, initialValue); |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * <!-- begin-user-doc --> |
| 400 | * <!-- end-user-doc --> |
| 401 | * @generated |
| 402 | */ |
| 403 | public String convertUnlimitedNaturalToString(EDataType eDataType, Object instanceValue) { |
| 404 | return super.convertToString(eDataType, instanceValue); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * <!-- begin-user-doc --> |
| 409 | * <!-- end-user-doc --> |
| 410 | * @generated |
| 411 | */ |
| 412 | public EMOFPackage getEMOFPackage() { |
| 413 | return (EMOFPackage)getEPackage(); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * <!-- begin-user-doc --> |
| 418 | * <!-- end-user-doc --> |
| 419 | * @deprecated |
| 420 | * @generated |
| 421 | */ |
| 422 | @Deprecated |
| 423 | public static EMOFPackage getPackage() { |
| 424 | return EMOFPackage.eINSTANCE; |
| 425 | } |
| 426 | |
| 427 | } //EMOFFactoryImpl |