| /******************************************************************************* |
| * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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 |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.emf.parsley.examples.mail.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.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| import org.eclipse.emf.parsley.examples.mail.Mail; |
| import org.eclipse.emf.parsley.examples.mail.MailPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Mail</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.emf.parsley.examples.mail.impl.MailImpl#getFrom <em>From</em>}</li> |
| * <li>{@link org.eclipse.emf.parsley.examples.mail.impl.MailImpl#getRecipients <em>Recipients</em>}</li> |
| * <li>{@link org.eclipse.emf.parsley.examples.mail.impl.MailImpl#getMessage <em>Message</em>}</li> |
| * <li>{@link org.eclipse.emf.parsley.examples.mail.impl.MailImpl#getSubject <em>Subject</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class MailImpl extends EObjectImpl implements Mail { |
| /** |
| * The default value of the '{@link #getFrom() <em>From</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFrom() |
| * @generated |
| * @ordered |
| */ |
| protected static final String FROM_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getFrom() <em>From</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFrom() |
| * @generated |
| * @ordered |
| */ |
| protected String from = FROM_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getRecipients() <em>Recipients</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRecipients() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> recipients; |
| |
| /** |
| * The default value of the '{@link #getMessage() <em>Message</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMessage() |
| * @generated |
| * @ordered |
| */ |
| protected static final String MESSAGE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMessage() |
| * @generated |
| * @ordered |
| */ |
| protected String message = MESSAGE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getSubject() <em>Subject</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSubject() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SUBJECT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSubject() <em>Subject</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSubject() |
| * @generated |
| * @ordered |
| */ |
| protected String subject = SUBJECT_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MailImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MailPackage.Literals.MAIL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getFrom() { |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFrom(String newFrom) { |
| String oldFrom = from; |
| from = newFrom; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MailPackage.MAIL__FROM, oldFrom, from)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getRecipients() { |
| if (recipients == null) { |
| recipients = new EDataTypeUniqueEList<String>(String.class, this, MailPackage.MAIL__RECIPIENTS); |
| } |
| return recipients; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getMessage() { |
| return message; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMessage(String newMessage) { |
| String oldMessage = message; |
| message = newMessage; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MailPackage.MAIL__MESSAGE, oldMessage, message)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getSubject() { |
| return subject; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSubject(String newSubject) { |
| String oldSubject = subject; |
| subject = newSubject; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MailPackage.MAIL__SUBJECT, oldSubject, subject)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case MailPackage.MAIL__FROM: |
| return getFrom(); |
| case MailPackage.MAIL__RECIPIENTS: |
| return getRecipients(); |
| case MailPackage.MAIL__MESSAGE: |
| return getMessage(); |
| case MailPackage.MAIL__SUBJECT: |
| return getSubject(); |
| } |
| 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 MailPackage.MAIL__FROM: |
| setFrom((String)newValue); |
| return; |
| case MailPackage.MAIL__RECIPIENTS: |
| getRecipients().clear(); |
| getRecipients().addAll((Collection<? extends String>)newValue); |
| return; |
| case MailPackage.MAIL__MESSAGE: |
| setMessage((String)newValue); |
| return; |
| case MailPackage.MAIL__SUBJECT: |
| setSubject((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MailPackage.MAIL__FROM: |
| setFrom(FROM_EDEFAULT); |
| return; |
| case MailPackage.MAIL__RECIPIENTS: |
| getRecipients().clear(); |
| return; |
| case MailPackage.MAIL__MESSAGE: |
| setMessage(MESSAGE_EDEFAULT); |
| return; |
| case MailPackage.MAIL__SUBJECT: |
| setSubject(SUBJECT_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MailPackage.MAIL__FROM: |
| return FROM_EDEFAULT == null ? from != null : !FROM_EDEFAULT.equals(from); |
| case MailPackage.MAIL__RECIPIENTS: |
| return recipients != null && !recipients.isEmpty(); |
| case MailPackage.MAIL__MESSAGE: |
| return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); |
| case MailPackage.MAIL__SUBJECT: |
| return SUBJECT_EDEFAULT == null ? subject != null : !SUBJECT_EDEFAULT.equals(subject); |
| } |
| 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(" (from: "); |
| result.append(from); |
| result.append(", recipients: "); |
| result.append(recipients); |
| result.append(", message: "); |
| result.append(message); |
| result.append(", subject: "); |
| result.append(subject); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MailImpl |