blob: 542c8dc18485ef20fda7b65717d7f746768c7e80 [file] [log] [blame]
/**
* Copyright (c) 2018 CEA
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Jérémie Tatibouet (CEA) jeremie.tatibouet@cea.fr - Initial API and implementation
* Benoit Maggi (CEA) benoit.maggi@cea.fr - Initial API and implementation
* Shuai Li (CEA) shuai.li@cea.fr - Integration of sensiNact and Web of Things Thing Description
*
*/
package org.eclipse.papyrus.iotml.wot.impl;
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;
import org.eclipse.papyrus.iotml.wot.*;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class WoTFactoryImpl extends EFactoryImpl implements WoTFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static WoTFactory init() {
try {
WoTFactory theWoTFactory = (WoTFactory)EPackage.Registry.INSTANCE.getEFactory(WoTPackage.eNS_URI);
if (theWoTFactory != null) {
return theWoTFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new WoTFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public WoTFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case WoTPackage.THING: return createThing();
case WoTPackage.SECURITY_SCHEME: return createSecurityScheme();
case WoTPackage.LINK: return createLink();
case WoTPackage.EVENT_AFFORDANCE: return createEventAffordance();
case WoTPackage.FORM: return createForm();
case WoTPackage.TYPE: return createType();
case WoTPackage.DATA_SCHEMA: return createDataSchema();
case WoTPackage.ACTION_AFFORDANCE: return createActionAffordance();
case WoTPackage.PROPERTY_AFFORDANCE: return createPropertyAffordance();
case WoTPackage.CONTEXT: return createContext();
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 WoTPackage.SECURITY_SCHEME_KIND:
return createSecuritySchemeKindFromString(eDataType, initialValue);
case WoTPackage.SECURITY_AUTHENTICATION_INFORMATION_LOCATION_KIND:
return createSecurityAuthenticationInformationLocationKindFromString(eDataType, initialValue);
case WoTPackage.QO_PKIND:
return createQoPKindFromString(eDataType, initialValue);
case WoTPackage.SECURITY_ALGORITHM_KIND:
return createSecurityAlgorithmKindFromString(eDataType, initialValue);
case WoTPackage.SECURITY_AUTHENTICATION_FORMAT_KIND:
return createSecurityAuthenticationFormatKindFromString(eDataType, initialValue);
case WoTPackage.AUTHORIZATION_FLOW_KIND:
return createAuthorizationFlowKindFromString(eDataType, initialValue);
case WoTPackage.OP_KIND:
return createOpKindFromString(eDataType, initialValue);
case WoTPackage.SUB_PROTOCOL_KIND:
return createSubProtocolKindFromString(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 WoTPackage.SECURITY_SCHEME_KIND:
return convertSecuritySchemeKindToString(eDataType, instanceValue);
case WoTPackage.SECURITY_AUTHENTICATION_INFORMATION_LOCATION_KIND:
return convertSecurityAuthenticationInformationLocationKindToString(eDataType, instanceValue);
case WoTPackage.QO_PKIND:
return convertQoPKindToString(eDataType, instanceValue);
case WoTPackage.SECURITY_ALGORITHM_KIND:
return convertSecurityAlgorithmKindToString(eDataType, instanceValue);
case WoTPackage.SECURITY_AUTHENTICATION_FORMAT_KIND:
return convertSecurityAuthenticationFormatKindToString(eDataType, instanceValue);
case WoTPackage.AUTHORIZATION_FLOW_KIND:
return convertAuthorizationFlowKindToString(eDataType, instanceValue);
case WoTPackage.OP_KIND:
return convertOpKindToString(eDataType, instanceValue);
case WoTPackage.SUB_PROTOCOL_KIND:
return convertSubProtocolKindToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Thing createThing() {
ThingImpl thing = new ThingImpl();
return thing;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public SecurityScheme createSecurityScheme() {
SecuritySchemeImpl securityScheme = new SecuritySchemeImpl();
return securityScheme;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Link createLink() {
LinkImpl link = new LinkImpl();
return link;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EventAffordance createEventAffordance() {
EventAffordanceImpl eventAffordance = new EventAffordanceImpl();
return eventAffordance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Form createForm() {
FormImpl form = new FormImpl();
return form;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Type createType() {
TypeImpl type = new TypeImpl();
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public DataSchema createDataSchema() {
DataSchemaImpl dataSchema = new DataSchemaImpl();
return dataSchema;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ActionAffordance createActionAffordance() {
ActionAffordanceImpl actionAffordance = new ActionAffordanceImpl();
return actionAffordance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public PropertyAffordance createPropertyAffordance() {
PropertyAffordanceImpl propertyAffordance = new PropertyAffordanceImpl();
return propertyAffordance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Context createContext() {
ContextImpl context = new ContextImpl();
return context;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SecuritySchemeKind createSecuritySchemeKindFromString(EDataType eDataType, String initialValue) {
SecuritySchemeKind result = SecuritySchemeKind.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 convertSecuritySchemeKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SecurityAuthenticationInformationLocationKind createSecurityAuthenticationInformationLocationKindFromString(EDataType eDataType, String initialValue) {
SecurityAuthenticationInformationLocationKind result = SecurityAuthenticationInformationLocationKind.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 convertSecurityAuthenticationInformationLocationKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QoPKind createQoPKindFromString(EDataType eDataType, String initialValue) {
QoPKind result = QoPKind.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 convertQoPKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SecurityAlgorithmKind createSecurityAlgorithmKindFromString(EDataType eDataType, String initialValue) {
SecurityAlgorithmKind result = SecurityAlgorithmKind.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 convertSecurityAlgorithmKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SecurityAuthenticationFormatKind createSecurityAuthenticationFormatKindFromString(EDataType eDataType, String initialValue) {
SecurityAuthenticationFormatKind result = SecurityAuthenticationFormatKind.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 convertSecurityAuthenticationFormatKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AuthorizationFlowKind createAuthorizationFlowKindFromString(EDataType eDataType, String initialValue) {
AuthorizationFlowKind result = AuthorizationFlowKind.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 convertAuthorizationFlowKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OpKind createOpKindFromString(EDataType eDataType, String initialValue) {
OpKind result = OpKind.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 convertOpKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubProtocolKind createSubProtocolKindFromString(EDataType eDataType, String initialValue) {
SubProtocolKind result = SubProtocolKind.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 convertSubProtocolKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public WoTPackage getWoTPackage() {
return (WoTPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static WoTPackage getPackage() {
return WoTPackage.eINSTANCE;
}
} //WoTFactoryImpl