/******************************************************************************* * 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.EStructuralFeature; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.jpt.core.internal.utility.translators.SimpleTranslator; import org.eclipse.wst.common.internal.emf.resource.Translator; /** * * A representation of the model object 'Discriminator Column'. * * 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. * * *

* The following features are supported: *

*

* * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn() * @model kind="class" * @generated */ public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn { /** * 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 DiscriminatorType DISCRIMINATOR_TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getDiscriminatorType() Discriminator Type}' attribute. * * * @see #getDiscriminatorType() * @generated * @ordered */ protected DiscriminatorType discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT; /** * The default value of the '{@link #getLength() Length}' attribute. * * * @see #getLength() * @generated * @ordered */ protected static final Integer LENGTH_EDEFAULT = null; /** * The cached value of the '{@link #getLength() Length}' attribute. * * * @see #getLength() * @generated * @ordered */ protected Integer length = LENGTH_EDEFAULT; /** * * * @generated */ protected XmlDiscriminatorColumn() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return OrmPackage.Literals.XML_DISCRIMINATOR_COLUMN; } /** * Returns the value of the 'Discriminator Type' attribute. * The default value is "STRING". * The literals are from the enumeration {@link org.eclipse.jpt.core.resource.orm.DiscriminatorType}. * *

* If the meaning of the 'Discriminator Type' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Discriminator Type' attribute. * @see org.eclipse.jpt.core.resource.orm.DiscriminatorType * @see #setDiscriminatorType(DiscriminatorType) * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn_DiscriminatorType() * @model default="STRING" * @generated */ public DiscriminatorType getDiscriminatorType() { return discriminatorType; } /** * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlDiscriminatorColumn#getDiscriminatorType Discriminator Type}' attribute. * * * @param value the new value of the 'Discriminator Type' attribute. * @see org.eclipse.jpt.core.resource.orm.DiscriminatorType * @see #getDiscriminatorType() * @generated */ public void setDiscriminatorType(DiscriminatorType newDiscriminatorType) { DiscriminatorType oldDiscriminatorType = discriminatorType; discriminatorType = newDiscriminatorType == null ? DISCRIMINATOR_TYPE_EDEFAULT : newDiscriminatorType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, discriminatorType)); } /** * Returns the value of the 'Length' attribute. * *

* If the meaning of the 'Length' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Length' attribute. * @see #setLength(Integer) * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn_Length() * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject" * @generated */ public Integer getLength() { return length; } /** * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlDiscriminatorColumn#getLength Length}' attribute. * * * @param value the new value of the 'Length' attribute. * @see #getLength() * @generated */ public void setLength(Integer newLength) { Integer oldLength = length; length = newLength; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH, oldLength, length)); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: return getDiscriminatorType(); case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH: return getLength(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: setDiscriminatorType((DiscriminatorType)newValue); return; case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH: setLength((Integer)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: setDiscriminatorType(DISCRIMINATOR_TYPE_EDEFAULT); return; case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH: setLength(LENGTH_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: return discriminatorType != DISCRIMINATOR_TYPE_EDEFAULT; case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH: return LENGTH_EDEFAULT == null ? length != null : !LENGTH_EDEFAULT.equals(length); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (discriminatorType: "); result.append(discriminatorType); result.append(", length: "); result.append(length); result.append(')'); return result.toString(); } // ********** translators ********** public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { return new SimpleTranslator( elementName, structuralFeature, Translator.END_TAG_NO_INDENT, buildTranslatorChildren() ); } private static Translator[] buildTranslatorChildren() { return new Translator[] { buildNameTranslator(), buildDiscrminiatorTypeTranslator(), buildColumnDefinitionTranslator(), buildLengthTranslator() }; } protected static Translator buildDiscrminiatorTypeTranslator() { return new Translator(JPA.DISCRIMINATOR_TYPE, OrmPackage.eINSTANCE.getXmlDiscriminatorColumn_DiscriminatorType(), Translator.DOM_ATTRIBUTE); } protected static Translator buildLengthTranslator() { return new Translator(JPA.LENGTH, OrmPackage.eINSTANCE.getXmlDiscriminatorColumn_Length(), Translator.DOM_ATTRIBUTE); } } // DiscriminatorColumn