/******************************************************************************* * Copyright (c) 2005, 2009 IBM Corporation and others. * 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: * IBM Corporation - initial implementation *******************************************************************************/ package org.eclipse.epf.xml.uma.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EDataTypeEList; import org.eclipse.epf.xml.uma.RoleDescriptor; import org.eclipse.epf.xml.uma.UmaPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Role Descriptor</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.epf.xml.uma.impl.RoleDescriptorImpl#getRole <em>Role</em>}</li> * <li>{@link org.eclipse.epf.xml.uma.impl.RoleDescriptorImpl#getResponsibleFor <em>Responsible For</em>}</li> * </ul> * </p> * * @generated */ public class RoleDescriptorImpl extends DescriptorImpl implements RoleDescriptor { /** * The default value of the '{@link #getRole() <em>Role</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRole() * @generated * @ordered */ protected static final String ROLE_EDEFAULT = null; /** * The cached value of the '{@link #getRole() <em>Role</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRole() * @generated * @ordered */ protected String role = ROLE_EDEFAULT; /** * The cached value of the '{@link #getResponsibleFor() <em>Responsible For</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getResponsibleFor() * @generated * @ordered */ protected EList<String> responsibleFor; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RoleDescriptorImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmaPackage.Literals.ROLE_DESCRIPTOR; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getRole() { return role; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRole(String newRole) { String oldRole = role; role = newRole; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmaPackage.ROLE_DESCRIPTOR__ROLE, oldRole, role)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<String> getResponsibleFor() { if (responsibleFor == null) { responsibleFor = new EDataTypeEList<String>(String.class, this, UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR); } return responsibleFor; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UmaPackage.ROLE_DESCRIPTOR__ROLE: return getRole(); case UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR: return getResponsibleFor(); } 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 UmaPackage.ROLE_DESCRIPTOR__ROLE: setRole((String)newValue); return; case UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR: getResponsibleFor().clear(); getResponsibleFor().addAll((Collection<? extends String>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmaPackage.ROLE_DESCRIPTOR__ROLE: setRole(ROLE_EDEFAULT); return; case UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR: getResponsibleFor().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UmaPackage.ROLE_DESCRIPTOR__ROLE: return ROLE_EDEFAULT == null ? role != null : !ROLE_EDEFAULT.equals(role); case UmaPackage.ROLE_DESCRIPTOR__RESPONSIBLE_FOR: return responsibleFor != null && !responsibleFor.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(" (role: "); result.append(role); result.append(", responsibleFor: "); result.append(responsibleFor); result.append(')'); return result.toString(); } } //RoleDescriptorImpl