| /******************************************************************************* |
| * 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.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.jpt.core.resource.xml.AbstractJpaEObject; |
| import org.eclipse.jpt.core.utility.TextRange; |
| import org.eclipse.wst.common.internal.emf.resource.Translator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>Type Mapping</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 --> |
| * |
| * |
| * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAbstractXmlTypeMapping() |
| * @model kind="class" abstract="true" |
| * @generated |
| */ |
| public abstract class AbstractXmlTypeMapping extends AbstractJpaEObject implements XmlTypeMapping |
| { |
| /** |
| * 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 AccessType ACCESS_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAccess() |
| * @generated |
| * @ordered |
| */ |
| protected AccessType access = ACCESS_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClassName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CLASS_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClassName() |
| * @generated |
| * @ordered |
| */ |
| protected String className = CLASS_NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMetadataComplete() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean METADATA_COMPLETE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMetadataComplete() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean metadataComplete = METADATA_COMPLETE_EDEFAULT; |
| |
| /** |
| * 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 cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributes() |
| * @generated |
| * @ordered |
| */ |
| protected Attributes attributes; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected AbstractXmlTypeMapping() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return OrmPackage.Literals.ABSTRACT_XML_TYPE_MAPPING; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Class Name</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Class 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>Class Name</em>' attribute. |
| * @see #setClassName(String) |
| * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTypeMapping_ClassName() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true" |
| * @generated |
| */ |
| public String getClassName() |
| { |
| return className; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping#getClassName <em>Class Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Class Name</em>' attribute. |
| * @see #getClassName() |
| * @generated |
| */ |
| public void setClassName(String newClassName) |
| { |
| String oldClassName = className; |
| className = newClassName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME, oldClassName, className)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Access</b></em>' attribute. |
| * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.AccessType}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Access</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Access</em>' attribute. |
| * @see org.eclipse.jpt.core.resource.orm.AccessType |
| * @see #setAccess(AccessType) |
| * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlAccessHolder_Access() |
| * @model |
| * @generated |
| */ |
| public AccessType getAccess() |
| { |
| return access; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping#getAccess <em>Access</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Access</em>' attribute. |
| * @see org.eclipse.jpt.core.resource.orm.AccessType |
| * @see #getAccess() |
| * @generated |
| */ |
| public void setAccess(AccessType newAccess) |
| { |
| AccessType oldAccess = access; |
| access = newAccess == null ? ACCESS_EDEFAULT : newAccess; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ACCESS, oldAccess, access)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Metadata Complete</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Metadata Complete</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Metadata Complete</em>' attribute. |
| * @see #setMetadataComplete(Boolean) |
| * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTypeMapping_MetadataComplete() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" |
| * @generated |
| */ |
| public Boolean getMetadataComplete() |
| { |
| return metadataComplete; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping#getMetadataComplete <em>Metadata Complete</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Metadata Complete</em>' attribute. |
| * @see #getMetadataComplete() |
| * @generated |
| */ |
| public void setMetadataComplete(Boolean newMetadataComplete) |
| { |
| Boolean oldMetadataComplete = metadataComplete; |
| metadataComplete = newMetadataComplete; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE, oldMetadataComplete, metadataComplete)); |
| } |
| |
| /** |
| * 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#getXmlTypeMapping_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.AbstractXmlTypeMapping#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.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION, oldDescription, description)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Attributes</b></em>' containment reference. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Attributes</em>' containment reference isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Attributes</em>' containment reference. |
| * @see #setAttributes(Attributes) |
| * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTypeMapping_Attributes() |
| * @model containment="true" |
| * @generated |
| */ |
| public Attributes getAttributes() |
| { |
| return attributes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAttributes(Attributes newAttributes, NotificationChain msgs) |
| { |
| Attributes oldAttributes = attributes; |
| attributes = newAttributes; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, oldAttributes, newAttributes); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping#getAttributes <em>Attributes</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Attributes</em>' containment reference. |
| * @see #getAttributes() |
| * @generated |
| */ |
| public void setAttributes(Attributes newAttributes) |
| { |
| if (newAttributes != attributes) |
| { |
| NotificationChain msgs = null; |
| if (attributes != null) |
| msgs = ((InternalEObject)attributes).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, null, msgs); |
| if (newAttributes != null) |
| msgs = ((InternalEObject)newAttributes).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, null, msgs); |
| msgs = basicSetAttributes(newAttributes, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, newAttributes, newAttributes)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES: |
| return basicSetAttributes(null, 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 OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ACCESS: |
| return getAccess(); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME: |
| return getClassName(); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE: |
| return getMetadataComplete(); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION: |
| return getDescription(); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES: |
| return getAttributes(); |
| } |
| 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.ABSTRACT_XML_TYPE_MAPPING__ACCESS: |
| setAccess((AccessType)newValue); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME: |
| setClassName((String)newValue); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE: |
| setMetadataComplete((Boolean)newValue); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION: |
| setDescription((String)newValue); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES: |
| setAttributes((Attributes)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ACCESS: |
| setAccess(ACCESS_EDEFAULT); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME: |
| setClassName(CLASS_NAME_EDEFAULT); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE: |
| setMetadataComplete(METADATA_COMPLETE_EDEFAULT); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION: |
| setDescription(DESCRIPTION_EDEFAULT); |
| return; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES: |
| setAttributes((Attributes)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ACCESS: |
| return access != ACCESS_EDEFAULT; |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME: |
| return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE: |
| return METADATA_COMPLETE_EDEFAULT == null ? metadataComplete != null : !METADATA_COMPLETE_EDEFAULT.equals(metadataComplete); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION: |
| return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); |
| case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES: |
| return attributes != 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(" (access: "); |
| result.append(access); |
| result.append(", className: "); |
| result.append(className); |
| result.append(", metadataComplete: "); |
| result.append(metadataComplete); |
| result.append(", description: "); |
| result.append(description); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| |
| public TextRange getClassTextRange() { |
| return getAttributeTextRange(JPA.CLASS); |
| } |
| |
| public TextRange getAttributesTextRange() { |
| return getAttributeTextRange(JPA.ATTRIBUTES); |
| } |
| |
| // ********** translators ********** |
| |
| protected static Translator buildClassTranslator() { |
| return new Translator(JPA.CLASS, OrmPackage.eINSTANCE.getXmlTypeMapping_ClassName(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildMetadataCompleteTranslator() { |
| return new Translator(JPA.METADATA_COMPLETE, OrmPackage.eINSTANCE.getXmlTypeMapping_MetadataComplete(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildDescriptionTranslator() { |
| return new Translator(JPA.DESCRIPTION, OrmPackage.eINSTANCE.getXmlTypeMapping_Description()); |
| } |
| |
| protected static Translator buildAttributesTranslator() { |
| return Attributes.buildTranslator(); |
| } |
| |
| } // TypeMapping |