Package SmartGen.impl

Source Code of SmartGen.impl.DataImpl

/**
* <copyright>
* </copyright>
*
* $Id$
*/
package SmartGen.impl;

import SmartGen.Data;
import SmartGen.FieldValue;
import SmartGen.SmartGenPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
*   <li>{@link SmartGen.impl.DataImpl#getFieldValues <em>Field Values</em>}</li>
*   <li>{@link SmartGen.impl.DataImpl#getTemplateId <em>Template Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DataImpl extends ValueImpl implements Data {
  /**
   * The cached value of the '{@link #getFieldValues() <em>Field Values</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFieldValues()
   * @generated
   * @ordered
   */
  protected EList fieldValues;

  /**
   * The default value of the '{@link #getTemplateId() <em>Template Id</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTemplateId()
   * @generated
   * @ordered
   */
  protected static final String TEMPLATE_ID_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getTemplateId() <em>Template Id</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTemplateId()
   * @generated
   * @ordered
   */
  protected String templateId = TEMPLATE_ID_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected DataImpl() {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EClass eStaticClass() {
    return SmartGenPackage.Literals.DATA;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList getFieldValues() {
    if (fieldValues == null) {
      fieldValues = new EObjectContainmentEList(FieldValue.class, this, SmartGenPackage.DATA__FIELD_VALUES);
    }
    return fieldValues;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getTemplateId() {
    return templateId;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTemplateId(String newTemplateId) {
    String oldTemplateId = templateId;
    templateId = newTemplateId;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, SmartGenPackage.DATA__TEMPLATE_ID, oldTemplateId, templateId));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
    switch (featureID) {
      case SmartGenPackage.DATA__FIELD_VALUES:
        return ((InternalEList)getFieldValues()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID) {
      case SmartGenPackage.DATA__FIELD_VALUES:
        return getFieldValues();
      case SmartGenPackage.DATA__TEMPLATE_ID:
        return getTemplateId();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case SmartGenPackage.DATA__FIELD_VALUES:
        getFieldValues().clear();
        getFieldValues().addAll((Collection)newValue);
        return;
      case SmartGenPackage.DATA__TEMPLATE_ID:
        setTemplateId((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eUnset(int featureID) {
    switch (featureID) {
      case SmartGenPackage.DATA__FIELD_VALUES:
        getFieldValues().clear();
        return;
      case SmartGenPackage.DATA__TEMPLATE_ID:
        setTemplateId(TEMPLATE_ID_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean eIsSet(int featureID) {
    switch (featureID) {
      case SmartGenPackage.DATA__FIELD_VALUES:
        return fieldValues != null && !fieldValues.isEmpty();
      case SmartGenPackage.DATA__TEMPLATE_ID:
        return TEMPLATE_ID_EDEFAULT == null ? templateId != null : !TEMPLATE_ID_EDEFAULT.equals(templateId);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (templateId: ");
    result.append(templateId);
    result.append(')');
    return result.toString();
  }

} //DataImpl
TOP

Related Classes of SmartGen.impl.DataImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.