| /**
|
| * *******************************************************************************
|
| * Copyright (c) 2009, 2019 Mia-Software and others.
|
| * All rights reserved. This program and the accompanying materials
|
| * are made available under the terms of the Eclipse Public License v2.0
|
| * which accompanies this distribution, and is available at
|
| * http://www.eclipse.org/legal/epl-v20.html
|
| *
|
| * Contributors:
|
| *
|
| * Fabien Giquel (Mia-Software) - initial API and implementation
|
| * Gregoire DUPE (Mia-Software) - initial API and implementation
|
| * *******************************************************************************
|
| *
|
| * $Id$
|
| */ |
| package org.eclipse.modisco.java.nousages.impl;
|
|
|
| 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.impl.EObjectImpl;
|
|
|
| import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
| import org.eclipse.emf.ecore.util.InternalEList;
|
| import org.eclipse.modisco.java.ManifestAttribute;
|
| import org.eclipse.modisco.java.ManifestEntry;
|
| import org.eclipse.modisco.java.nousages.meta.JavaPackage;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * An implementation of the model object '<em><b>Manifest Entry</b></em>'.
|
| * <!-- end-user-doc -->
|
| * <p>
|
| * The following features are implemented:
|
| * <ul>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.ManifestEntryImpl#getName <em>Name</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.ManifestEntryImpl#getAttributes <em>Attributes</em>}</li>
|
| * </ul>
|
| * </p>
|
| *
|
| * @generated
|
| */
|
| public class ManifestEntryImpl extends EObjectImpl implements ManifestEntry {
|
| /**
|
| * The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getName()
|
| * @generated
|
| * @ordered
|
| */
|
| protected static final String NAME_EDEFAULT = null;
|
|
|
| /**
|
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getName()
|
| * @generated
|
| * @ordered
|
| */
|
| protected String name = NAME_EDEFAULT;
|
|
|
| /**
|
| * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getAttributes()
|
| * @generated
|
| * @ordered
|
| */
|
| protected EList<ManifestAttribute> attributes;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| protected ManifestEntryImpl() {
|
| super();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| protected EClass eStaticClass() {
|
| return JavaPackage.eINSTANCE.getManifestEntry();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public String getName() {
|
| return name;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setName(String newName) {
|
| String oldName = name;
|
| name = newName;
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.MANIFEST_ENTRY__NAME, oldName, name));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<ManifestAttribute> getAttributes() {
|
| if (attributes == null) {
|
| attributes = new EObjectContainmentEList<ManifestAttribute>(ManifestAttribute.class, this, JavaPackage.MANIFEST_ENTRY__ATTRIBUTES);
|
| }
|
| return attributes;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
| switch (featureID) {
|
| case JavaPackage.MANIFEST_ENTRY__ATTRIBUTES:
|
| return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, msgs);
|
| }
|
| return super.eInverseRemove(otherEnd, featureID, msgs);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
| switch (featureID) {
|
| case JavaPackage.MANIFEST_ENTRY__NAME:
|
| return getName();
|
| case JavaPackage.MANIFEST_ENTRY__ATTRIBUTES:
|
| return getAttributes();
|
| }
|
| return super.eGet(featureID, resolve, coreType);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @SuppressWarnings("unchecked")
|
| @Override
|
| public void eSet(int featureID, Object newValue) {
|
| switch (featureID) {
|
| case JavaPackage.MANIFEST_ENTRY__NAME:
|
| setName((String)newValue);
|
| return;
|
| case JavaPackage.MANIFEST_ENTRY__ATTRIBUTES:
|
| getAttributes().clear();
|
| getAttributes().addAll((Collection<? extends ManifestAttribute>)newValue);
|
| return;
|
| }
|
| super.eSet(featureID, newValue);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eUnset(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.MANIFEST_ENTRY__NAME:
|
| setName(NAME_EDEFAULT);
|
| return;
|
| case JavaPackage.MANIFEST_ENTRY__ATTRIBUTES:
|
| getAttributes().clear();
|
| return;
|
| }
|
| super.eUnset(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public boolean eIsSet(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.MANIFEST_ENTRY__NAME:
|
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
| case JavaPackage.MANIFEST_ENTRY__ATTRIBUTES:
|
| return attributes != null && !attributes.isEmpty();
|
| }
|
| return super.eIsSet(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public String toString() {
|
| if (eIsProxy()) return super.toString();
|
|
|
| StringBuffer result = new StringBuffer(super.toString());
|
| result.append(" (name: "); //$NON-NLS-1$
|
| result.append(name);
|
| result.append(')');
|
| return result.toString();
|
| }
|
|
|
| } //ManifestEntryImpl
|