| /******************************************************************************* |
| * Copyright (c) 2012, 2013 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0, which accompanies this distribution |
| * and is available at https://www.eclipse.org/legal/epl-2.0/. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.eclipselink.core.resource.orm; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; |
| import org.eclipse.jpt.common.core.resource.xml.EBaseObjectImpl; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.DataFormatType; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.EclipseLink2_4; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.EclipseLinkOrmV2_4Package; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlNoSql_2_4; |
| import org.eclipse.wst.common.internal.emf.resource.Translator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>Xml No Sql</b></em>'. |
| * <!-- end-user-doc --> |
| * |
| * |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNoSql() |
| * @model kind="class" |
| * @generated |
| */ |
| public class XmlNoSql extends EBaseObjectImpl implements XmlNoSql_2_4 |
| { |
| /** |
| * The default value of the '{@link #getDataType() <em>Data Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataType() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DATA_TYPE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDataType() <em>Data Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataType() |
| * @generated |
| * @ordered |
| */ |
| protected String dataType = DATA_TYPE_EDEFAULT; |
| |
| /** |
| * changed this to null and removed the generated flag so emf won't generate over it |
| * we don't want a default for enums, just null if the tag does not exist |
| */ |
| protected static final DataFormatType DATA_FORMAT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDataFormat() <em>Data Format</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataFormat() |
| * @generated |
| * @ordered |
| */ |
| protected DataFormatType dataFormat = DATA_FORMAT_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected XmlNoSql() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return EclipseLinkOrmPackage.Literals.XML_NO_SQL; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Data Type</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Data Type</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Data Type</em>' attribute. |
| * @see #setDataType(String) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNoSql_2_4_DataType() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public String getDataType() |
| { |
| return dataType; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNoSql#getDataType <em>Data Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Data Type</em>' attribute. |
| * @see #getDataType() |
| * @generated |
| */ |
| public void setDataType(String newDataType) |
| { |
| String oldDataType = dataType; |
| dataType = newDataType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_NO_SQL__DATA_TYPE, oldDataType, dataType)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Data Format</b></em>' attribute. |
| * The default value is <code>""</code>. |
| * The literals are from the enumeration {@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.DataFormatType}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Data Format</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Data Format</em>' attribute. |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.DataFormatType |
| * @see #setDataFormat(DataFormatType) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNoSql_2_4_DataFormat() |
| * @model default="" |
| * @generated |
| */ |
| public DataFormatType getDataFormat() |
| { |
| return dataFormat; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNoSql#getDataFormat <em>Data Format</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Data Format</em>' attribute. |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.DataFormatType |
| * @see #getDataFormat() |
| * @generated |
| */ |
| public void setDataFormat(DataFormatType newDataFormat) |
| { |
| DataFormatType oldDataFormat = dataFormat; |
| dataFormat = newDataFormat == null ? DATA_FORMAT_EDEFAULT : newDataFormat; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_NO_SQL__DATA_FORMAT, oldDataFormat, dataFormat)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_TYPE: |
| return getDataType(); |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_FORMAT: |
| return getDataFormat(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_TYPE: |
| setDataType((String)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_FORMAT: |
| setDataFormat((DataFormatType)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_TYPE: |
| setDataType(DATA_TYPE_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_FORMAT: |
| setDataFormat(DATA_FORMAT_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_TYPE: |
| return DATA_TYPE_EDEFAULT == null ? dataType != null : !DATA_TYPE_EDEFAULT.equals(dataType); |
| case EclipseLinkOrmPackage.XML_NO_SQL__DATA_FORMAT: |
| return dataFormat != DATA_FORMAT_EDEFAULT; |
| } |
| 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(" (dataType: "); |
| result.append(dataType); |
| result.append(", dataFormat: "); |
| result.append(dataFormat); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| // ********** translators ********** |
| |
| public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { |
| return new SimpleTranslator( |
| elementName, |
| structuralFeature, |
| EclipseLinkOrmPackage.eINSTANCE.getXmlNoSql(), |
| buildTranslatorChildren()); |
| } |
| |
| private static Translator[] buildTranslatorChildren() { |
| return new Translator[] { |
| buildDataTypeTranslator(), |
| buildDataFormatTranslator(), |
| }; |
| } |
| |
| protected static Translator buildDataTypeTranslator() { |
| return new Translator(EclipseLink2_4.NO_SQL__DATA_TYPE, EclipseLinkOrmV2_4Package.eINSTANCE.getXmlNoSql_2_4_DataType(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildDataFormatTranslator() { |
| return new Translator(EclipseLink2_4.NO_SQL__DATA_FORMAT, EclipseLinkOrmV2_4Package.eINSTANCE.getXmlNoSql_2_4_DataFormat(), Translator.DOM_ATTRIBUTE); |
| } |
| } // XmlNoSql |