| /******************************************************************************* |
| * Copyright (c) 2008-2011 Chair for Applied Software Engineering, |
| * Technische Universitaet Muenchen. |
| * 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: |
| ******************************************************************************/ |
| package org.eclipse.emf.emfstore.internal.common.model.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| import org.eclipse.emf.emfstore.internal.common.model.IdentifiableElement; |
| import org.eclipse.emf.emfstore.internal.common.model.ModelPackage; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>Identifiable Element</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.emf.emfstore.internal.common.model.impl.IdentifiableElementImpl#getIdentifier <em>Identifier |
| * </em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class IdentifiableElementImpl extends EObjectImpl implements IdentifiableElement { |
| /** |
| * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. |
| * <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getIdentifier() |
| * @generated |
| * @ordered |
| */ |
| protected static final String IDENTIFIER_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. |
| * <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getIdentifier() |
| * @generated |
| * @ordered |
| */ |
| protected String identifier = IDENTIFIER_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| protected IdentifiableElementImpl() { |
| super(); |
| identifier = EcoreUtil.generateUUID(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> . <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ModelPackage.Literals.IDENTIFIABLE_ELEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getIdentifier() { |
| return identifier; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setIdentifier(String newIdentifier) { |
| final String oldIdentifier = identifier; |
| identifier = newIdentifier; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.IDENTIFIABLE_ELEMENT__IDENTIFIER, |
| oldIdentifier, identifier)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ModelPackage.IDENTIFIABLE_ELEMENT__IDENTIFIER: |
| return getIdentifier(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ModelPackage.IDENTIFIABLE_ELEMENT__IDENTIFIER: |
| setIdentifier((String) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ModelPackage.IDENTIFIABLE_ELEMENT__IDENTIFIER: |
| setIdentifier(IDENTIFIER_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ModelPackage.IDENTIFIABLE_ELEMENT__IDENTIFIER: |
| return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) { |
| return super.toString(); |
| } |
| |
| final StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (identifier: "); //$NON-NLS-1$ |
| result.append(identifier); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // IdentifiableElementImpl |