/**
* Copyright (c) 2015 Obeo.
* 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.htm
* Contributors: Obeo - initial API and implementation
*/
package org.eclipse.sirius.validation.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.MinimalEObjectImpl;
import org.eclipse.sirius.validation.Severity;
import org.eclipse.sirius.validation.SiriusStatus;
import org.eclipse.sirius.validation.ValidationPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Sirius Status</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.sirius.validation.impl.SiriusStatusImpl#getMessage <em>Message</em>}</li>
* <li>{@link org.eclipse.sirius.validation.impl.SiriusStatusImpl#getSeverity <em>Severity</em>}</li>
* <li>{@link org.eclipse.sirius.validation.impl.SiriusStatusImpl#getException <em>Exception</em>}</li>
* </ul>
*
* @generated
*/
public class SiriusStatusImpl extends MinimalEObjectImpl.Container implements SiriusStatus {
/**
* 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 #getSeverity() <em>Severity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSeverity()
* @generated
* @ordered
*/
protected static final Severity SEVERITY_EDEFAULT = Severity.INFO;
/**
* The cached value of the '{@link #getSeverity() <em>Severity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSeverity()
* @generated
* @ordered
*/
protected Severity severity = SEVERITY_EDEFAULT;
/**
* The cached value of the '{@link #getException() <em>Exception</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getException()
* @generated
* @ordered
*/
protected Object exception;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SiriusStatusImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ValidationPackage.Literals.SIRIUS_STATUS;
}
/**
* <!-- 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, ValidationPackage.SIRIUS_STATUS__MESSAGE, oldMessage, message));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Severity getSeverity() {
return severity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSeverity(Severity newSeverity) {
Severity oldSeverity = severity;
severity = newSeverity == null ? SEVERITY_EDEFAULT : newSeverity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ValidationPackage.SIRIUS_STATUS__SEVERITY, oldSeverity, severity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object getException() {
return exception;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setException(Object newException) {
Object oldException = exception;
exception = newException;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ValidationPackage.SIRIUS_STATUS__EXCEPTION, oldException, exception));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ValidationPackage.SIRIUS_STATUS__MESSAGE:
return getMessage();
case ValidationPackage.SIRIUS_STATUS__SEVERITY:
return getSeverity();
case ValidationPackage.SIRIUS_STATUS__EXCEPTION:
return getException();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ValidationPackage.SIRIUS_STATUS__MESSAGE:
setMessage((String)newValue);
return;
case ValidationPackage.SIRIUS_STATUS__SEVERITY:
setSeverity((Severity)newValue);
return;
case ValidationPackage.SIRIUS_STATUS__EXCEPTION:
setException(newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ValidationPackage.SIRIUS_STATUS__MESSAGE:
setMessage(MESSAGE_EDEFAULT);
return;
case ValidationPackage.SIRIUS_STATUS__SEVERITY:
setSeverity(SEVERITY_EDEFAULT);
return;
case ValidationPackage.SIRIUS_STATUS__EXCEPTION:
setException((Object)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ValidationPackage.SIRIUS_STATUS__MESSAGE:
return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message);
case ValidationPackage.SIRIUS_STATUS__SEVERITY:
return severity != SEVERITY_EDEFAULT;
case ValidationPackage.SIRIUS_STATUS__EXCEPTION:
return exception != null;
}
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(" (message: ");
result.append(message);
result.append(", severity: ");
result.append(severity);
result.append(", exception: ");
result.append(exception);
result.append(')');
return result.toString();
}
} //SiriusStatusImpl