blob: e1de3f77ee9852dc2e59796e984d04168f81cd03 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 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.internal.content.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.internal.mappings.INamedNativeQuery;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Xml Named Native Query</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedNativeQuery()
* @model kind="class"
* @generated
*/
public class XmlNamedNativeQuery extends AbstractXmlQuery
implements INamedNativeQuery
{
/**
* The default value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResultClass()
* @generated
* @ordered
*/
protected static final String RESULT_CLASS_EDEFAULT = null;
/**
* The cached value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResultClass()
* @generated
* @ordered
*/
protected String resultClass = RESULT_CLASS_EDEFAULT;
/**
* The default value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResultSetMapping()
* @generated
* @ordered
*/
protected static final String RESULT_SET_MAPPING_EDEFAULT = null;
/**
* The cached value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResultSetMapping()
* @generated
* @ordered
*/
protected String resultSetMapping = RESULT_SET_MAPPING_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected XmlNamedNativeQuery() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OrmPackage.Literals.XML_NAMED_NATIVE_QUERY;
}
/**
* Returns the value of the '<em><b>Result Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Result Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Result Class</em>' attribute.
* @see #setResultClass(String)
* @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedNativeQuery_ResultClass()
* @model
* @generated
*/
public String getResultClass() {
return resultClass;
}
/**
* Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery#getResultClass <em>Result Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Result Class</em>' attribute.
* @see #getResultClass()
* @generated
*/
public void setResultClass(String newResultClass) {
String oldResultClass = resultClass;
resultClass = newResultClass;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS, oldResultClass, resultClass));
}
/**
* Returns the value of the '<em><b>Result Set Mapping</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Result Set Mapping</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Result Set Mapping</em>' attribute.
* @see #setResultSetMapping(String)
* @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedNativeQuery_ResultSetMapping()
* @model
* @generated
*/
public String getResultSetMapping() {
return resultSetMapping;
}
/**
* Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Result Set Mapping</em>' attribute.
* @see #getResultSetMapping()
* @generated
*/
public void setResultSetMapping(String newResultSetMapping) {
String oldResultSetMapping = resultSetMapping;
resultSetMapping = newResultSetMapping;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING, oldResultSetMapping, resultSetMapping));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
return getResultClass();
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
return getResultSetMapping();
}
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.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
setResultClass((String) newValue);
return;
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
setResultSetMapping((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
setResultClass(RESULT_CLASS_EDEFAULT);
return;
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
setResultSetMapping(RESULT_SET_MAPPING_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
return RESULT_CLASS_EDEFAULT == null ? resultClass != null : !RESULT_CLASS_EDEFAULT.equals(resultClass);
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
return RESULT_SET_MAPPING_EDEFAULT == null ? resultSetMapping != null : !RESULT_SET_MAPPING_EDEFAULT.equals(resultSetMapping);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == INamedNativeQuery.class) {
switch (derivedFeatureID) {
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS;
case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
default :
return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == INamedNativeQuery.class) {
switch (baseFeatureID) {
case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS :
return OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS;
case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
return OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (resultClass: ");
result.append(resultClass);
result.append(", resultSetMapping: ");
result.append(resultSetMapping);
result.append(')');
return result.toString();
}
} // XmlNamedNativeQuery