001/** 002 * ****************************************************************************** 003 * Copyright (c) 2018 Red Hat Inc 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * * 009 * Contributors: 010 * Jens Reimann - initial API and implementation 011 * ****************************************************************************** 012 */ 013package de.dentrassi.varlink.idl.varlinkIdl.impl; 014 015import de.dentrassi.varlink.idl.varlinkIdl.ElementType; 016import de.dentrassi.varlink.idl.varlinkIdl.Field; 017import de.dentrassi.varlink.idl.varlinkIdl.VarlinkIdlPackage; 018 019import org.eclipse.emf.common.notify.Notification; 020import org.eclipse.emf.common.notify.NotificationChain; 021 022import org.eclipse.emf.ecore.EClass; 023import org.eclipse.emf.ecore.InternalEObject; 024 025import org.eclipse.emf.ecore.impl.ENotificationImpl; 026import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 027 028/** 029 * <!-- begin-user-doc --> 030 * An implementation of the model object '<em><b>Field</b></em>'. 031 * <!-- end-user-doc --> 032 * <p> 033 * The following features are implemented: 034 * </p> 035 * <ul> 036 * <li>{@link de.dentrassi.varlink.idl.varlinkIdl.impl.FieldImpl#getName <em>Name</em>}</li> 037 * <li>{@link de.dentrassi.varlink.idl.varlinkIdl.impl.FieldImpl#getType <em>Type</em>}</li> 038 * </ul> 039 * 040 * @generated 041 */ 042public class FieldImpl extends MinimalEObjectImpl.Container implements Field 043{ 044 /** 045 * The default value of the '{@link #getName() <em>Name</em>}' attribute. 046 * <!-- begin-user-doc --> 047 * <!-- end-user-doc --> 048 * @see #getName() 049 * @generated 050 * @ordered 051 */ 052 protected static final String NAME_EDEFAULT = null; 053 054 /** 055 * The cached value of the '{@link #getName() <em>Name</em>}' attribute. 056 * <!-- begin-user-doc --> 057 * <!-- end-user-doc --> 058 * @see #getName() 059 * @generated 060 * @ordered 061 */ 062 protected String name = NAME_EDEFAULT; 063 064 /** 065 * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. 066 * <!-- begin-user-doc --> 067 * <!-- end-user-doc --> 068 * @see #getType() 069 * @generated 070 * @ordered 071 */ 072 protected ElementType type; 073 074 /** 075 * <!-- begin-user-doc --> 076 * <!-- end-user-doc --> 077 * @generated 078 */ 079 protected FieldImpl() 080 { 081 super(); 082 } 083 084 /** 085 * <!-- begin-user-doc --> 086 * <!-- end-user-doc --> 087 * @generated 088 */ 089 @Override 090 protected EClass eStaticClass() 091 { 092 return VarlinkIdlPackage.Literals.FIELD; 093 } 094 095 /** 096 * <!-- begin-user-doc --> 097 * <!-- end-user-doc --> 098 * @generated 099 */ 100 public String getName() 101 { 102 return name; 103 } 104 105 /** 106 * <!-- begin-user-doc --> 107 * <!-- end-user-doc --> 108 * @generated 109 */ 110 public void setName(String newName) 111 { 112 String oldName = name; 113 name = newName; 114 if (eNotificationRequired()) 115 eNotify(new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.FIELD__NAME, oldName, name)); 116 } 117 118 /** 119 * <!-- begin-user-doc --> 120 * <!-- end-user-doc --> 121 * @generated 122 */ 123 public ElementType getType() 124 { 125 return type; 126 } 127 128 /** 129 * <!-- begin-user-doc --> 130 * <!-- end-user-doc --> 131 * @generated 132 */ 133 public NotificationChain basicSetType(ElementType newType, NotificationChain msgs) 134 { 135 ElementType oldType = type; 136 type = newType; 137 if (eNotificationRequired()) 138 { 139 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.FIELD__TYPE, oldType, newType); 140 if (msgs == null) msgs = notification; else msgs.add(notification); 141 } 142 return msgs; 143 } 144 145 /** 146 * <!-- begin-user-doc --> 147 * <!-- end-user-doc --> 148 * @generated 149 */ 150 public void setType(ElementType newType) 151 { 152 if (newType != type) 153 { 154 NotificationChain msgs = null; 155 if (type != null) 156 msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.FIELD__TYPE, null, msgs); 157 if (newType != null) 158 msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.FIELD__TYPE, null, msgs); 159 msgs = basicSetType(newType, msgs); 160 if (msgs != null) msgs.dispatch(); 161 } 162 else if (eNotificationRequired()) 163 eNotify(new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.FIELD__TYPE, newType, newType)); 164 } 165 166 /** 167 * <!-- begin-user-doc --> 168 * <!-- end-user-doc --> 169 * @generated 170 */ 171 @Override 172 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) 173 { 174 switch (featureID) 175 { 176 case VarlinkIdlPackage.FIELD__TYPE: 177 return basicSetType(null, msgs); 178 } 179 return super.eInverseRemove(otherEnd, featureID, msgs); 180 } 181 182 /** 183 * <!-- begin-user-doc --> 184 * <!-- end-user-doc --> 185 * @generated 186 */ 187 @Override 188 public Object eGet(int featureID, boolean resolve, boolean coreType) 189 { 190 switch (featureID) 191 { 192 case VarlinkIdlPackage.FIELD__NAME: 193 return getName(); 194 case VarlinkIdlPackage.FIELD__TYPE: 195 return getType(); 196 } 197 return super.eGet(featureID, resolve, coreType); 198 } 199 200 /** 201 * <!-- begin-user-doc --> 202 * <!-- end-user-doc --> 203 * @generated 204 */ 205 @Override 206 public void eSet(int featureID, Object newValue) 207 { 208 switch (featureID) 209 { 210 case VarlinkIdlPackage.FIELD__NAME: 211 setName((String)newValue); 212 return; 213 case VarlinkIdlPackage.FIELD__TYPE: 214 setType((ElementType)newValue); 215 return; 216 } 217 super.eSet(featureID, newValue); 218 } 219 220 /** 221 * <!-- begin-user-doc --> 222 * <!-- end-user-doc --> 223 * @generated 224 */ 225 @Override 226 public void eUnset(int featureID) 227 { 228 switch (featureID) 229 { 230 case VarlinkIdlPackage.FIELD__NAME: 231 setName(NAME_EDEFAULT); 232 return; 233 case VarlinkIdlPackage.FIELD__TYPE: 234 setType((ElementType)null); 235 return; 236 } 237 super.eUnset(featureID); 238 } 239 240 /** 241 * <!-- begin-user-doc --> 242 * <!-- end-user-doc --> 243 * @generated 244 */ 245 @Override 246 public boolean eIsSet(int featureID) 247 { 248 switch (featureID) 249 { 250 case VarlinkIdlPackage.FIELD__NAME: 251 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 252 case VarlinkIdlPackage.FIELD__TYPE: 253 return type != null; 254 } 255 return super.eIsSet(featureID); 256 } 257 258 /** 259 * <!-- begin-user-doc --> 260 * <!-- end-user-doc --> 261 * @generated 262 */ 263 @Override 264 public String toString() 265 { 266 if (eIsProxy()) return super.toString(); 267 268 StringBuffer result = new StringBuffer(super.toString()); 269 result.append(" (name: "); 270 result.append(name); 271 result.append(')'); 272 return result.toString(); 273 } 274 275} //FieldImpl