| /******************************************************************************* |
| * Copyright (c) 2008 xored software, Inc. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * xored software, Inc. - initial API and Implementation (Andrei Sobolev) |
| *******************************************************************************/ |
| package org.eclipse.dltk.tcl.definitions.impl; |
| |
| import org.eclipse.dltk.tcl.definitions.*; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EPackage; |
| |
| import org.eclipse.emf.ecore.impl.EFactoryImpl; |
| |
| import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class DefinitionsFactoryImpl extends EFactoryImpl implements DefinitionsFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static DefinitionsFactory init() { |
| try { |
| DefinitionsFactory theDefinitionsFactory = (DefinitionsFactory)EPackage.Registry.INSTANCE.getEFactory(DefinitionsPackage.eNS_URI); |
| if (theDefinitionsFactory != null) { |
| return theDefinitionsFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new DefinitionsFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DefinitionsFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case DefinitionsPackage.COMMAND: return createCommand(); |
| case DefinitionsPackage.SCOPE: return createScope(); |
| case DefinitionsPackage.CONSTANT: return createConstant(); |
| case DefinitionsPackage.GROUP: return createGroup(); |
| case DefinitionsPackage.SWITCH: return createSwitch(); |
| case DefinitionsPackage.TYPED_ARGUMENT: return createTypedArgument(); |
| case DefinitionsPackage.NAMESPACE: return createNamespace(); |
| case DefinitionsPackage.COMPLEX_ARGUMENT: return createComplexArgument(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case DefinitionsPackage.ARGUMENT_TYPE: |
| return createArgumentTypeFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case DefinitionsPackage.ARGUMENT_TYPE: |
| return convertArgumentTypeToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Command createCommand() { |
| CommandImpl command = new CommandImpl(); |
| return command; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Scope createScope() { |
| ScopeImpl scope = new ScopeImpl(); |
| return scope; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Constant createConstant() { |
| ConstantImpl constant = new ConstantImpl(); |
| return constant; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Group createGroup() { |
| GroupImpl group = new GroupImpl(); |
| return group; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Switch createSwitch() { |
| SwitchImpl switch_ = new SwitchImpl(); |
| return switch_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TypedArgument createTypedArgument() { |
| TypedArgumentImpl typedArgument = new TypedArgumentImpl(); |
| return typedArgument; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Namespace createNamespace() { |
| NamespaceImpl namespace = new NamespaceImpl(); |
| return namespace; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ComplexArgument createComplexArgument() { |
| ComplexArgumentImpl complexArgument = new ComplexArgumentImpl(); |
| return complexArgument; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ArgumentType createArgumentTypeFromString(EDataType eDataType, String initialValue) { |
| ArgumentType result = ArgumentType.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertArgumentTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DefinitionsPackage getDefinitionsPackage() { |
| return (DefinitionsPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static DefinitionsPackage getPackage() { |
| return DefinitionsPackage.eINSTANCE; |
| } |
| |
| } //DefinitionsFactoryImpl |