| /******************************************************************************* |
| * Copyright (c) 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.core.resource.orm; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; |
| import org.eclipse.jpt.common.core.resource.xml.EBaseObjectImpl; |
| |
| import org.eclipse.jpt.jpa.core.resource.orm.v2_1.ColumnResult_2_1; |
| import org.eclipse.jpt.jpa.core.resource.orm.v2_1.ConstructorResult_2_1; |
| import org.eclipse.jpt.jpa.core.resource.orm.v2_1.JPA2_1; |
| import org.eclipse.jpt.jpa.core.resource.orm.v2_1.OrmV2_1Package; |
| import org.eclipse.wst.common.internal.emf.resource.Translator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>Constructor Result</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.jpa.core.resource.orm.OrmPackage#getConstructorResult() |
| * @model kind="class" |
| * @generated |
| */ |
| public class ConstructorResult extends EBaseObjectImpl implements ConstructorResult_2_1 |
| { |
| /** |
| * The default value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargetClass() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TARGET_CLASS_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargetClass() |
| * @generated |
| * @ordered |
| */ |
| protected String targetClass = TARGET_CLASS_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getColumns() <em>Columns</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumns() |
| * @generated |
| * @ordered |
| */ |
| protected EList<ColumnResult> columns; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ConstructorResult() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return OrmPackage.Literals.CONSTRUCTOR_RESULT; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Target Class</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Target 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>Target Class</em>' attribute. |
| * @see #setTargetClass(String) |
| * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getConstructorResult_2_1_TargetClass() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true" |
| * @generated |
| */ |
| public String getTargetClass() |
| { |
| return targetClass; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.ConstructorResult#getTargetClass <em>Target Class</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Target Class</em>' attribute. |
| * @see #getTargetClass() |
| * @generated |
| */ |
| public void setTargetClass(String newTargetClass) |
| { |
| String oldTargetClass = targetClass; |
| targetClass = newTargetClass; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CONSTRUCTOR_RESULT__TARGET_CLASS, oldTargetClass, targetClass)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Columns</b></em>' containment reference list. |
| * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.ColumnResult}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Columns</em>' containment reference list isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Columns</em>' containment reference list. |
| * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getConstructorResult_2_1_Columns() |
| * @model containment="true" |
| * @generated |
| */ |
| public EList<ColumnResult> getColumns() |
| { |
| if (columns == null) |
| { |
| columns = new EObjectContainmentEList<ColumnResult>(ColumnResult.class, this, OrmPackage.CONSTRUCTOR_RESULT__COLUMNS); |
| } |
| return columns; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.CONSTRUCTOR_RESULT__COLUMNS: |
| return ((InternalEList<?>)getColumns()).basicRemove(otherEnd, 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.CONSTRUCTOR_RESULT__TARGET_CLASS: |
| return getTargetClass(); |
| case OrmPackage.CONSTRUCTOR_RESULT__COLUMNS: |
| return getColumns(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.CONSTRUCTOR_RESULT__TARGET_CLASS: |
| setTargetClass((String)newValue); |
| return; |
| case OrmPackage.CONSTRUCTOR_RESULT__COLUMNS: |
| getColumns().clear(); |
| getColumns().addAll((Collection<? extends ColumnResult>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.CONSTRUCTOR_RESULT__TARGET_CLASS: |
| setTargetClass(TARGET_CLASS_EDEFAULT); |
| return; |
| case OrmPackage.CONSTRUCTOR_RESULT__COLUMNS: |
| getColumns().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case OrmPackage.CONSTRUCTOR_RESULT__TARGET_CLASS: |
| return TARGET_CLASS_EDEFAULT == null ? targetClass != null : !TARGET_CLASS_EDEFAULT.equals(targetClass); |
| case OrmPackage.CONSTRUCTOR_RESULT__COLUMNS: |
| return columns != null && !columns.isEmpty(); |
| } |
| 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(" (targetClass: "); |
| result.append(targetClass); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| // ********** translators ********** |
| |
| public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { |
| return new SimpleTranslator( |
| elementName, |
| structuralFeature, |
| OrmPackage.eINSTANCE.getConstructorResult(), |
| buildTranslatorChildren() |
| ); |
| } |
| |
| private static Translator[] buildTranslatorChildren() { |
| return new Translator[] { |
| buildColumnTranslator(), |
| buildTargetClassTranslator(), |
| }; |
| } |
| |
| protected static Translator buildColumnTranslator() { |
| return ColumnResult.buildTranslator(JPA2_1.COLUMN, OrmV2_1Package.eINSTANCE.getConstructorResult_2_1_Columns()); |
| } |
| |
| protected static Translator buildTargetClassTranslator() { |
| return new Translator(JPA2_1.TARGET_CLASS, OrmV2_1Package.eINSTANCE.getConstructorResult_2_1_TargetClass(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| } // ConstructorResult |