blob: e81d2ce3791d5c930105d1e156272fc1c49e750e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2009 Oracle. 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:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.core.resource.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.core.resource.orm.v2_0.JPA2_0;
import org.eclipse.jpt.core.resource.orm.v2_0.OrmV2_0Package;
import org.eclipse.jpt.core.resource.orm.v2_0.XmlEventMethod_2_0;
import org.eclipse.jpt.core.resource.xml.AbstractJpaEObject;
import org.eclipse.wst.common.internal.emf.resource.Translator;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Event Method</b></em>'.
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.jpt.core.resource.orm.EventMethod#getMethodName <em>Method Name</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEventMethod()
* @model kind="class" abstract="true"
* @generated
*/
public abstract class EventMethod extends AbstractJpaEObject implements XmlEventMethod_2_0
{
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getMethodName() <em>Method Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMethodName()
* @generated
* @ordered
*/
protected static final String METHOD_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getMethodName() <em>Method Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMethodName()
* @generated
* @ordered
*/
protected String methodName = METHOD_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EventMethod()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return OrmPackage.Literals.EVENT_METHOD;
}
/**
* Returns the value of the '<em><b>Description</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Description</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Description</em>' attribute.
* @see #setDescription(String)
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlEventMethod_2_0_Description()
* @model dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
public String getDescription()
{
return description;
}
/**
* Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.EventMethod#getDescription <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Description</em>' attribute.
* @see #getDescription()
* @generated
*/
public void setDescription(String newDescription)
{
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.EVENT_METHOD__DESCRIPTION, oldDescription, description));
}
/**
* Returns the value of the '<em><b>Method Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Method Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Method Name</em>' attribute.
* @see #setMethodName(String)
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEventMethod_MethodName()
* @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
public String getMethodName() {
return methodName;
}
/**
* Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.EventMethod#getMethodName <em>Method Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Method Name</em>' attribute.
* @see #getMethodName()
* @generated
*/
public void setMethodName(String newMethodName) {
String oldMethodName = methodName;
methodName = newMethodName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.EVENT_METHOD__METHOD_NAME, oldMethodName, methodName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case OrmPackage.EVENT_METHOD__DESCRIPTION:
return getDescription();
case OrmPackage.EVENT_METHOD__METHOD_NAME:
return getMethodName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case OrmPackage.EVENT_METHOD__DESCRIPTION:
setDescription((String)newValue);
return;
case OrmPackage.EVENT_METHOD__METHOD_NAME:
setMethodName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case OrmPackage.EVENT_METHOD__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case OrmPackage.EVENT_METHOD__METHOD_NAME:
setMethodName(METHOD_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case OrmPackage.EVENT_METHOD__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case OrmPackage.EVENT_METHOD__METHOD_NAME:
return METHOD_NAME_EDEFAULT == null ? methodName != null : !METHOD_NAME_EDEFAULT.equals(methodName);
}
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(" (description: ");
result.append(description);
result.append(", methodName: ");
result.append(methodName);
result.append(')');
return result.toString();
}
// ********** translators **********
protected static Translator[] buildTranslatorChildren() {
return new Translator[] {
buildMethodNameTranslator(),
buildDescriptionTranslator()
};
}
protected static Translator buildMethodNameTranslator() {
return new Translator(JPA.METHOD_NAME, OrmPackage.eINSTANCE.getEventMethod_MethodName(), Translator.DOM_ATTRIBUTE);
}
protected static Translator buildDescriptionTranslator() {
return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlEventMethod_2_0_Description());
}
}