diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java | 268 |
1 files changed, 0 insertions, 268 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java deleted file mode 100644 index 467b5a512d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************* - * 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.java.mappings; - -import java.util.Iterator; -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.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; -import org.eclipse.jpt.core.internal.ITypeMapping; -import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.Member; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.mappings.IAttributeOverride; -import org.eclipse.jpt.core.internal.mappings.IColumn; -import org.eclipse.jpt.core.internal.mappings.IColumnMapping; -import org.eclipse.jpt.core.internal.mappings.INamedColumn; -import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.utility.internal.Filter; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Java Attribute Override</b></em>'. - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeOverride() - * @model kind="class" - * @generated - */ -public class JavaAttributeOverride extends JavaOverride - implements IAttributeOverride -{ - /** - * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getColumn() - * @generated - * @ordered - */ - protected IColumn column; - - public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDE); - - public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDES); - - protected JavaAttributeOverride() { - throw new UnsupportedOperationException("use JavaAttributeOverride(Owner, Member, IndexedDeclarationAnnotationAdapter)"); - } - - protected JavaAttributeOverride(Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) { - super(owner, member, daa); - this.column = JavaColumn.createAttributeOverrideColumn(this.buildColumnOwner(), member, daa); - ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN, null, null); - } - - @Override - protected String nameElementName() { - return JPA.ATTRIBUTE_OVERRIDE__NAME; - } - - // TODO figure out how to use [stupid] EMF to implement the Column.Owner interface directly - protected INamedColumn.Owner buildColumnOwner() { - return new ColumnOwner(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return JpaJavaMappingsPackage.Literals.JAVA_ATTRIBUTE_OVERRIDE; - } - - /** - * Returns the value of the '<em><b>Column</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Column</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>Column</em>' containment reference. - * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAttributeOverride_Column() - * @model containment="true" required="true" changeable="false" - * @generated - */ - public IColumn getColumn() { - return column; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) { - IColumn oldColumn = column; - column = newColumn; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN, oldColumn, newColumn); - if (msgs == null) - msgs = notification; - else - msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN : - return basicSetColumn(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 JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN : - return getColumn(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN : - return column != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == IColumnMapping.class) { - switch (derivedFeatureID) { - default : - return -1; - } - } - if (baseClass == IAttributeOverride.class) { - switch (derivedFeatureID) { - case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN : - return JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN; - 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 == IColumnMapping.class) { - switch (baseFeatureID) { - default : - return -1; - } - } - if (baseClass == IAttributeOverride.class) { - switch (baseFeatureID) { - case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN : - return JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN; - default : - return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - @Override - public void updateFromJava(CompilationUnit astRoot) { - super.updateFromJava(astRoot); - this.getJavaColumn().updateFromJava(astRoot); - } - - private JavaColumn getJavaColumn() { - return (JavaColumn) this.column; - } - - @Override - protected Iterator<String> candidateNames() { - return this.getOwner().getTypeMapping().allOverridableAttributeNames(); - } - - @Override - public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.getJavaColumn().candidateValuesFor(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - // ********** static methods ********** - static JavaAttributeOverride createAttributeOverride(Owner owner, Member member, int index) { - return JpaJavaMappingsFactory.eINSTANCE.createJavaAttributeOverride(owner, member, buildAnnotationAdapter(index)); - } - - private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) { - return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.ATTRIBUTE_OVERRIDE); - } - - - // ********** member class ********** - public class ColumnOwner implements INamedColumn.Owner - { - public ITypeMapping getTypeMapping() { - return JavaAttributeOverride.this.getOwner().getTypeMapping(); - } - - public ITextRange validationTextRange() { - return JavaAttributeOverride.this.validationTextRange(); - } - - public Table dbTable(String tableName) { - return this.getTypeMapping().dbTable(tableName); - } - } -} |