blob: 399efc7b4ac9164931524e2536668dcf4e34b4ed [file] [log] [blame]
/**
* Copyright (c) 2010, 2012 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.html
*
* Contributors:
* Obeo - initial API and implementation
*/
package org.eclipse.mylyn.docs.intent.bridge.java.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.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.mylyn.docs.intent.bridge.java.JavaPackage;
import org.eclipse.mylyn.docs.intent.bridge.java.Method;
import org.eclipse.mylyn.docs.intent.bridge.java.Parameter;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Method</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.MethodImpl#getSimpleName <em>Simple Name</em>}</li>
* <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.MethodImpl#getReturnType <em>Return Type</em>}</li>
* <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.MethodImpl#getParameters <em>Parameters</em>}</li>
* <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.MethodImpl#getContent <em>Content</em>}</li>
* <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.MethodImpl#getExceptions <em>Exceptions</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MethodImpl extends AbstractCapableElementImpl implements Method {
/**
* The default value of the '{@link #getSimpleName() <em>Simple Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSimpleName()
* @generated
* @ordered
*/
protected static final String SIMPLE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getSimpleName() <em>Simple Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSimpleName()
* @generated
* @ordered
*/
protected String simpleName = SIMPLE_NAME_EDEFAULT;
/**
* The default value of the '{@link #getReturnType() <em>Return Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReturnType()
* @generated
* @ordered
*/
protected static final String RETURN_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getReturnType() <em>Return Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReturnType()
* @generated
* @ordered
*/
protected String returnType = RETURN_TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParameters()
* @generated
* @ordered
*/
protected EList<Parameter> parameters;
/**
* The default value of the '{@link #getContent() <em>Content</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContent()
* @generated
* @ordered
*/
protected static final String CONTENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getContent() <em>Content</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContent()
* @generated
* @ordered
*/
protected String content = CONTENT_EDEFAULT;
/**
* The cached value of the '{@link #getExceptions() <em>Exceptions</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExceptions()
* @generated
* @ordered
*/
protected EList<String> exceptions;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MethodImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.Literals.METHOD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSimpleName() {
return simpleName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSimpleName(String newSimpleName) {
String oldSimpleName = simpleName;
simpleName = newSimpleName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD__SIMPLE_NAME, oldSimpleName, simpleName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getReturnType() {
return returnType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReturnType(String newReturnType) {
String oldReturnType = returnType;
returnType = newReturnType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD__RETURN_TYPE, oldReturnType, returnType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Parameter> getParameters() {
if (parameters == null) {
parameters = new EObjectContainmentEList<Parameter>(Parameter.class, this, JavaPackage.METHOD__PARAMETERS);
}
return parameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getContent() {
return content;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setContent(String newContent) {
String oldContent = content;
content = newContent;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD__CONTENT, oldContent, content));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getExceptions() {
if (exceptions == null) {
exceptions = new EDataTypeUniqueEList<String>(String.class, this, JavaPackage.METHOD__EXCEPTIONS);
}
return exceptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.METHOD__PARAMETERS:
return ((InternalEList<?>)getParameters()).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.METHOD__SIMPLE_NAME:
return getSimpleName();
case JavaPackage.METHOD__RETURN_TYPE:
return getReturnType();
case JavaPackage.METHOD__PARAMETERS:
return getParameters();
case JavaPackage.METHOD__CONTENT:
return getContent();
case JavaPackage.METHOD__EXCEPTIONS:
return getExceptions();
}
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.METHOD__SIMPLE_NAME:
setSimpleName((String)newValue);
return;
case JavaPackage.METHOD__RETURN_TYPE:
setReturnType((String)newValue);
return;
case JavaPackage.METHOD__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection<? extends Parameter>)newValue);
return;
case JavaPackage.METHOD__CONTENT:
setContent((String)newValue);
return;
case JavaPackage.METHOD__EXCEPTIONS:
getExceptions().clear();
getExceptions().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 JavaPackage.METHOD__SIMPLE_NAME:
setSimpleName(SIMPLE_NAME_EDEFAULT);
return;
case JavaPackage.METHOD__RETURN_TYPE:
setReturnType(RETURN_TYPE_EDEFAULT);
return;
case JavaPackage.METHOD__PARAMETERS:
getParameters().clear();
return;
case JavaPackage.METHOD__CONTENT:
setContent(CONTENT_EDEFAULT);
return;
case JavaPackage.METHOD__EXCEPTIONS:
getExceptions().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.METHOD__SIMPLE_NAME:
return SIMPLE_NAME_EDEFAULT == null ? simpleName != null : !SIMPLE_NAME_EDEFAULT.equals(simpleName);
case JavaPackage.METHOD__RETURN_TYPE:
return RETURN_TYPE_EDEFAULT == null ? returnType != null : !RETURN_TYPE_EDEFAULT.equals(returnType);
case JavaPackage.METHOD__PARAMETERS:
return parameters != null && !parameters.isEmpty();
case JavaPackage.METHOD__CONTENT:
return CONTENT_EDEFAULT == null ? content != null : !CONTENT_EDEFAULT.equals(content);
case JavaPackage.METHOD__EXCEPTIONS:
return exceptions != null && !exceptions.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(" (simpleName: ");
result.append(simpleName);
result.append(", returnType: ");
result.append(returnType);
result.append(", content: ");
result.append(content);
result.append(", exceptions: ");
result.append(exceptions);
result.append(')');
return result.toString();
}
} //MethodImpl