diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary')
67 files changed, 0 insertions, 7527 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java deleted file mode 100644 index e2b775110b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.resource.java.binary; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.ContainerAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator; - -/** - * binary annotated element - */ -abstract class BinaryAnnotatedElement - extends BinaryNode - implements JavaResourceAnnotatedElement -{ - /** JDT annotated element adapter */ - final Adapter adapter; - - /** annotations */ - final Vector<Annotation> annotations = new Vector<Annotation>(); - - /** - * these are built as needed - */ - private final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>(); - - - // ********** construction/initialization ********** - - public BinaryAnnotatedElement(JavaResourceNode parent, Adapter adapter) { - super(parent); - this.adapter = adapter; - this.initializeAnnotations(); - } - - private void initializeAnnotations() { - for (IAnnotation annotation : this.getJdtAnnotations()) { - this.addAnnotation(annotation); - } - } - - private void addAnnotation(IAnnotation jdtAnnotation) { - if (this.annotationIsValid(jdtAnnotation)) { - this.annotations.add(this.buildAnnotation(jdtAnnotation)); - } - } - - - // ********** updating ********** - - @Override - public void update() { - super.update(); - this.updateAnnotations(); - } - - // TODO - private void updateAnnotations() { - throw new UnsupportedOperationException(); - } - - - // ********** annotations ********** - - public Iterator<Annotation> annotations() { - return this.getAnnotations().iterator(); - } - - private Iterable<Annotation> getAnnotations() { - return new LiveCloneIterable<Annotation>(this.annotations); - } - - public int annotationsSize() { - return this.annotations.size(); - } - - public Annotation getAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getAnnotations(), annotationName); - } - - public Annotation getNonNullAnnotation(String annotationName) { - Annotation annotation = this.getAnnotation(annotationName); - return (annotation != null) ? annotation : this.getNullAnnotation(annotationName); - } - - private synchronized Annotation getNullAnnotation(String annotationName) { - Annotation annotation = this.nullAnnotationsCache.get(annotationName); - if (annotation == null) { - annotation = this.buildNullAnnotation(annotationName); - this.nullAnnotationsCache.put(annotationName, annotation); - } - return annotation; - } - - public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName); - if (containerAnnotation != null) { - return containerAnnotation.getNestedAnnotations().iterator(); - } - NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName); - return (nestableAnnotation == null) ? - EmptyListIterator.<NestableAnnotation>instance() : - new SingleElementIterator<NestableAnnotation>(nestableAnnotation); - } - - private NestableAnnotation getNestableAnnotation(String annotationName) { - return (NestableAnnotation) this.getAnnotation(annotationName); - } - - @SuppressWarnings("unchecked") - private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) { - return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName); - } - - private boolean annotationIsValid(IAnnotation jdtAnnotation) { - return CollectionTools.contains(this.validAnnotationNames(), jdtAnnotation.getElementName()); - } - - abstract Iterator<String> validAnnotationNames(); - - abstract Annotation buildAnnotation(IAnnotation jdtAnnotation); - - abstract Annotation buildNullAnnotation(String annotationName); - - - // ********** simple state ********** - - public boolean isAnnotated() { - return ! this.annotations.isEmpty(); - } - - - // ********** misc ********** - - IJavaElement getAnnotatedElement() { - return this.adapter.getElement(); - } - - private Annotation selectAnnotationNamed(Iterable<Annotation> annotationList, String annotationName) { - for (Annotation annotation : annotationList) { - if (annotation.getAnnotationName().equals(annotationName)) { - return annotation; - } - } - return null; - } - - private IAnnotation[] getJdtAnnotations() { - try { - return this.adapter.getAnnotations(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_JDT_ANNOTATION_ARRAY; - } - } - private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0]; - - - // ********** IJavaElement adapter ********** - - interface Adapter { - /** - * Return the adapter's JDT element (IPackageFragment, IType, IField, IMethod). - */ - IJavaElement getElement(); - - /** - * Return the adapter's element's JDT annotations. - */ - IAnnotation[] getAnnotations() throws JavaModelException; - } - - - // ********** unsupported JavaResourcePersistentMember implementation ********** - - public Annotation addAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) { - throw new UnsupportedOperationException(); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java deleted file mode 100644 index 86e581f644..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Map; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IMemberValuePair; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.ContainerAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; - -/** - * JAR annotation - */ -public abstract class BinaryAnnotation - extends BinaryNode - implements Annotation -{ - final IAnnotation jdtAnnotation; - - protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent); - this.jdtAnnotation = jdtAnnotation; - } - - - // ********** convenience methods ********** - - /** - * Return the values of the JDT annotation's member with the specified name. - */ - protected Object[] getJdtMemberValues(String memberName) { - Object[] values = (Object[]) this.getJdtMemberValue(memberName); - return (values != null) ? values : EMPTY_OBJECT_ARRAY; - } - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - /** - * Return the value of the JDT annotation's member with the specified name. - */ - protected Object getJdtMemberValue(String memberName) { - IMemberValuePair pair = this.getJdtMemberValuePair(memberName); - return (pair == null) ? null : pair.getValue(); - } - - /** - * Return the JDT annotation's member-value pair with the specified name. - */ - private IMemberValuePair getJdtMemberValuePair(String memberName) { - for (IMemberValuePair pair : this.getJdtMemberValuePairs()) { - if (pair.getMemberName().equals(memberName)) { - return pair; - } - } - return null; - } - - private IMemberValuePair[] getJdtMemberValuePairs() { - try { - return this.jdtAnnotation.getMemberValuePairs(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_MEMBER_VALUE_PAIR_ARRAY; - } - } - private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0]; - - - // ********** Annotation implementation ********** - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - public boolean isUnset() { - throw new UnsupportedOperationException(); - } - - // ********** NestableAnnotation implementation ********** - public void moveAnnotation(@SuppressWarnings("unused") int index) { - throw new UnsupportedOperationException(); - } - public void convertToNested(@SuppressWarnings("unused") ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, @SuppressWarnings("unused") DeclarationAnnotationAdapter containerAnnotationAdapter, @SuppressWarnings("unused") int index) { - throw new UnsupportedOperationException(); - } - public void convertToStandAlone() { - throw new UnsupportedOperationException(); - } - - // ********** misc ********** - public void storeOn(Map<String, Object> map) { - throw new UnsupportedOperationException(); - } - public void restoreFrom(Map<String, Object> map) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java deleted file mode 100644 index 439b0442b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.AssociationOverride - */ -public abstract class BinaryAssociationOverrideAnnotation - extends BinaryOverrideAnnotation - implements NestableAssociationOverrideAnnotation -{ - private final Vector<JoinColumnAnnotation> joinColumns; - - - protected BinaryAssociationOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinColumns = this.buildJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateJoinColumns(); - } - - - // ********** BinaryOverrideAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.ASSOCIATION_OVERRIDE__NAME; - } - - - // ********** AssociationOverrideAnnotation implementation ********** - - // ***** join columns - public ListIterator<JoinColumnAnnotation> joinColumns() { - return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<JoinColumnAnnotation> buildJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS); - Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updateJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java deleted file mode 100644 index f4894e174d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.AssociationOverrides - */ -public abstract class BinaryAssociationOverridesAnnotation - extends BinaryContainerAnnotation<NestableAssociationOverrideAnnotation> - implements AssociationOverridesAnnotation -{ - private final Vector<NestableAssociationOverrideAnnotation> associationOverrides; - - - protected BinaryAssociationOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.associationOverrides = this.buildAssociationOverrides(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableAssociationOverrideAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableAssociationOverrideAnnotation>(this.associationOverrides); - } - - public int getNestedAnnotationsSize() { - return this.associationOverrides.size(); - } - - private Vector<NestableAssociationOverrideAnnotation> buildAssociationOverrides() { - Object[] jdtAssociationOverrides = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDES__VALUE); - Vector<NestableAssociationOverrideAnnotation> result = new Vector<NestableAssociationOverrideAnnotation>(jdtAssociationOverrides.length); - for (Object jdtAssociationOverride : jdtAssociationOverrides) { - result.add(buildAssociationOverride(jdtAssociationOverride)); - } - return result; - } - - protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride); - - @Override - public void update() { - super.update(); - this.updateAssociationOverrides(); - } - - // TODO - private void updateAssociationOverrides() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java deleted file mode 100644 index ba8aba5227..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverrideColumnAnnotation; -import org.eclipse.jpt.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation; - -/** - * javax.persistence.AttributeOverride - */ -public final class BinaryAttributeOverrideAnnotation - extends BinaryOverrideAnnotation - implements NestableAttributeOverrideAnnotation -{ - private ColumnAnnotation column; - private final ColumnAnnotation nullColumn; - - - public BinaryAttributeOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.column = this.buildColumn(); - this.nullColumn = this.buildNullColumn(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateColumn(); - } - - - //************ BinaryOverrideAnnotation implementation **************** - - @Override - protected String getNameElementName() { - return JPA.ATTRIBUTE_OVERRIDE__NAME; - } - - - //************ AttributeOverride implementation **************** - - // ***** column - public ColumnAnnotation getColumn() { - return this.column; - } - - public ColumnAnnotation getNonNullColumn() { - return (this.column != null) ? this.column : this.nullColumn; - } - - public ColumnAnnotation addColumn() { - throw new UnsupportedOperationException(); - } - - public void removeColumn() { - throw new UnsupportedOperationException(); - } - - private ColumnAnnotation buildColumn() { - IAnnotation jdtColumn = this.getJdtColumn(); - return (jdtColumn == null) ? null : this.buildColumn(jdtColumn); - } - - private ColumnAnnotation buildNullColumn() { - return new NullAttributeOverrideColumnAnnotation(this); - } - - private ColumnAnnotation buildColumn(IAnnotation jdtColumn) { - return new BinaryColumnAnnotation(this, jdtColumn); - } - - private IAnnotation getJdtColumn() { - return (IAnnotation) this.getJdtMemberValue(JPA.ATTRIBUTE_OVERRIDE__COLUMN); - } - - private void setColumn(ColumnAnnotation column) { - ColumnAnnotation old = this.column; - this.column = column; - this.firePropertyChanged(COLUMN_PROPERTY, old, column); - } - - // TODO - private void updateColumn() { - throw new UnsupportedOperationException(); -// IAnnotation jdtColumn = this.getJdtColumn(); -// if (jdtColumn == null) { -// this.setColumn(null); -// } else { -// if (this.column == null) { -// this.setColumn(this.buildColumn(jdtColumn)); -// } else { -// this.column.update(jdtColumn); -// } -// } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java deleted file mode 100644 index 1cecad35c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.AttributeOverrides - */ -public final class BinaryAttributeOverridesAnnotation - extends BinaryContainerAnnotation<NestableAttributeOverrideAnnotation> - implements AttributeOverridesAnnotation -{ - private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides; - - - public BinaryAttributeOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.attributeOverrides = this.buildAttributeOverrides(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributeOverrides); - } - - public int getNestedAnnotationsSize() { - return this.attributeOverrides.size(); - } - - private Vector<NestableAttributeOverrideAnnotation> buildAttributeOverrides() { - Object[] jdtAttributeOverrides = this.getJdtMemberValues(JPA.ATTRIBUTE_OVERRIDES__VALUE); - Vector<NestableAttributeOverrideAnnotation> result = new Vector<NestableAttributeOverrideAnnotation>(jdtAttributeOverrides.length); - for (Object jdtAttributeOverride : jdtAttributeOverrides) { - result.add(new BinaryAttributeOverrideAnnotation(this, (IAnnotation) jdtAttributeOverride)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateAttributeOverrides(); - } - - // TODO - private void updateAttributeOverrides() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java deleted file mode 100644 index a0d263f06e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.Column - * javax.persistence.JoinColumn - */ -public abstract class BinaryBaseColumnAnnotation - extends BinaryNamedColumnAnnotation - implements BaseColumnAnnotation -{ - private String table; - private Boolean unique; - private Boolean nullable; - private Boolean insertable; - private Boolean updatable; - - - protected BinaryBaseColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.table = this.buildTable(); - this.unique = this.buildUnique(); - this.nullable = this.buildNullable(); - this.insertable = this.buildInsertable(); - this.updatable = this.buildUpdatable(); - } - - @Override - public void update() { - super.update(); - this.setTable_(this.buildTable()); - this.setUnique_(this.buildUnique()); - this.setNullable_(this.buildNullable()); - this.setInsertable_(this.buildInsertable()); - this.setUpdatable_(this.buildUpdatable()); - } - - - //************* BaseColumnAnnotation implementation ************* - - // ***** table - public String getTable() { - return this.table; - } - - public void setTable(String table) { - throw new UnsupportedOperationException(); - } - - private void setTable_(String table) { - String old = this.table; - this.table = table; - this.firePropertyChanged(TABLE_PROPERTY, old, table); - } - - private String buildTable() { - return (String) this.getJdtMemberValue(this.getTableElementName()); - } - - protected abstract String getTableElementName(); - - public TextRange getTableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean tableTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** unique - public Boolean getUnique() { - return this.unique; - } - - public void setUnique(Boolean unique) { - throw new UnsupportedOperationException(); - } - - private void setUnique_(Boolean unique) { - Boolean old = this.unique; - this.unique = unique; - this.firePropertyChanged(UNIQUE_PROPERTY, old, unique); - } - - private Boolean buildUnique() { - return (Boolean) this.getJdtMemberValue(this.getUniqueElementName()); - } - - protected abstract String getUniqueElementName(); - - public TextRange getUniqueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** nullable - public Boolean getNullable() { - return this.nullable; - } - - public void setNullable(Boolean nullable) { - throw new UnsupportedOperationException(); - } - - private void setNullable_(Boolean nullable) { - Boolean old = this.nullable; - this.nullable = nullable; - this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable); - } - - private Boolean buildNullable() { - return (Boolean) this.getJdtMemberValue(this.getNullableElementName()); - } - - protected abstract String getNullableElementName(); - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** insertable - public Boolean getInsertable() { - return this.insertable; - } - - public void setInsertable(Boolean insertable) { - throw new UnsupportedOperationException(); - } - - private void setInsertable_(Boolean insertable) { - Boolean old = this.insertable; - this.insertable = insertable; - this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable); - } - - private Boolean buildInsertable() { - return (Boolean) this.getJdtMemberValue(this.getInsertableElementName()); - } - - protected abstract String getInsertableElementName(); - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** updatable - public Boolean getUpdatable() { - return this.updatable; - } - - public void setUpdatable(Boolean updatable) { - throw new UnsupportedOperationException(); - } - - private void setUpdatable_(Boolean updatable) { - Boolean old = this.updatable; - this.updatable = updatable; - this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable); - } - - private Boolean buildUpdatable() { - return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName()); - } - - protected abstract String getUpdatableElementName(); - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java deleted file mode 100644 index 4c4c619f3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.EnumType; -import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.Enumerated - */ -public abstract class BinaryBaseEnumeratedAnnotation - extends BinaryAnnotation - implements EnumeratedAnnotation -{ - private EnumType value; - - - protected BinaryBaseEnumeratedAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** EnumeratedAnnotation implementation ********** - - // ***** value - public EnumType getValue() { - return this.value; - } - - public void setValue(EnumType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(EnumType value) { - EnumType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private EnumType buildValue() { - return EnumType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getValueElementName())); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - protected abstract String getValueElementName(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java deleted file mode 100644 index cbbfaff723..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.BaseJoinColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.JoinColumn - * javax.persistence.MapKeyJoinColumn - */ -public abstract class BinaryBaseJoinColumnAnnotation - extends BinaryBaseColumnAnnotation - implements BaseJoinColumnAnnotation -{ - private String referencedColumnName; - - - public BinaryBaseJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.referencedColumnName = this.buildReferencedColumnName(); - } - - @Override - public void update() { - super.update(); - this.setReferencedColumnName_(this.buildReferencedColumnName()); - } - - protected abstract String getReferencedColumnNameElementName(); - - - //************ BaseJoinColumnAnnotation implementation *************** - - // referenced column name - public String getReferencedColumnName() { - return this.referencedColumnName; - } - - public void setReferencedColumnName(String referencedColumnName) { - throw new UnsupportedOperationException(); - } - - private void setReferencedColumnName_(String referencedColumnName) { - String old = this.referencedColumnName; - this.referencedColumnName = referencedColumnName; - this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName); - } - - private String buildReferencedColumnName() { - return (String) this.getJdtMemberValue(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME); - } - - public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java deleted file mode 100644 index e59382c3e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.BaseTableAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.Table - * javax.persistence.JoinTable - * javax.persistence.SecondaryTable - */ -public abstract class BinaryBaseTableAnnotation - extends BinaryAnnotation - implements BaseTableAnnotation -{ - String name; - String schema; - String catalog; - final Vector<UniqueConstraintAnnotation> uniqueConstraints; - - - protected BinaryBaseTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.schema = this.buildSchema(); - this.catalog = this.buildCatalog(); - this.uniqueConstraints = this.buildUniqueConstraints(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setSchema_(this.buildSchema()); - this.setCatalog_(this.buildCatalog()); - this.updateUniqueConstraints(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** BaseTableAnnotation implementation ********** - - public boolean isSpecified() { - return true; - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - protected abstract String getNameElementName(); - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** schema - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - throw new UnsupportedOperationException(); - } - - private void setSchema_(String schema) { - String old = this.schema; - this.schema = schema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, schema); - } - - private String buildSchema() { - return (String) this.getJdtMemberValue(this.getSchemaElementName()); - } - - protected abstract String getSchemaElementName(); - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** catalog - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - throw new UnsupportedOperationException(); - } - - private void setCatalog_(String catalog) { - String old = this.catalog; - this.catalog = catalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, catalog); - } - - private String buildCatalog() { - return (String) this.getJdtMemberValue(this.getCatalogElementName()); - } - - protected abstract String getCatalogElementName(); - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** unique constraints - public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() { - return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public UniqueConstraintAnnotation uniqueConstraintAt(int index) { - return this.uniqueConstraints.get(index); - } - - public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) { - return this.uniqueConstraints.indexOf(uniqueConstraint); - } - - public UniqueConstraintAnnotation addUniqueConstraint(int index) { - throw new UnsupportedOperationException(); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeUniqueConstraint(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() { - Object[] jdtUniqueConstraints = this.getJdtMemberValues(this.getUniqueConstraintElementName()); - Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length); - for (Object jdtUniqueConstraint : jdtUniqueConstraints) { - result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint)); - } - return result; - } - - protected abstract String getUniqueConstraintElementName(); - - // TODO - private void updateUniqueConstraints() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java deleted file mode 100644 index 8ad2917c45..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.TemporalAnnotation; -import org.eclipse.jpt.core.resource.java.TemporalType; - -/** - * javax.persistence.Temporal - * javax.persistence.MapKeyTemporal - */ -public abstract class BinaryBaseTemporalAnnotation - extends BinaryAnnotation - implements TemporalAnnotation -{ - private TemporalType value; - - - protected BinaryBaseTemporalAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** TemporalAnnotation implementation ********** - - // ***** value - public TemporalType getValue() { - return this.value; - } - - public void setValue(TemporalType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(TemporalType value) { - TemporalType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private TemporalType buildValue() { - return TemporalType.fromJavaAnnotationValue(this.getJdtMemberValue(getValueElementName())); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - protected abstract String getValueElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java deleted file mode 100644 index 6feeabb30d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.BasicAnnotation; -import org.eclipse.jpt.core.resource.java.FetchType; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Basic - */ -public final class BinaryBasicAnnotation - extends BinaryAnnotation - implements BasicAnnotation -{ - private Boolean optional; - private FetchType fetch; - - - public BinaryBasicAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.optional = this.buildOptional(); - this.fetch = this.buildFetch(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setOptional_(this.buildOptional()); - this.setFetch_(this.buildFetch()); - } - - - //*************** Basic implementation **************** - - // ***** optional - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - throw new UnsupportedOperationException(); - } - - private void setOptional_(Boolean optional) { - Boolean old = this.optional; - this.optional = optional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional); - } - - private Boolean buildOptional() { - return (Boolean) this.getJdtMemberValue(JPA.BASIC__OPTIONAL); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - throw new UnsupportedOperationException(); - } - - private void setFetch_(FetchType fetch) { - FetchType old = this.fetch; - this.fetch = fetch; - this.firePropertyChanged(FETCH_PROPERTY, old, fetch); - } - - private FetchType buildFetch() { - return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.BASIC__FETCH)); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java deleted file mode 100644 index 037eda1ea4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.resource.java.JavaResourceClassFile; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * binary class file - */ -final class BinaryClassFile - extends BinaryNode - implements JavaResourceClassFile -{ - /** JDT class file */ - private final IClassFile classFile; - - /** class file's persistent type */ - private final JavaResourcePersistentType persistentType; - - - // ********** construction/initialization ********** - - /** - * The JDT type gets passed in because the package fragment inspects it - * beforehand to determine whether it is "persistable". (We only build - * class files for "persistable" types.) - */ - BinaryClassFile(JavaResourcePackageFragment parent, IClassFile classFile, IType jdtType) { - super(parent); - this.classFile = classFile; - this.persistentType = this.buildPersistentType(jdtType); - } - - private JavaResourcePersistentType buildPersistentType(IType jdtType) { - return new BinaryPersistentType(this, jdtType); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.classFile.getElementName()); - } - - - // ********** JavaResourceClassFile implementation ********** - - public JavaResourcePersistentType getPersistentType() { - return this.persistentType; - } - - // TODO - @Override - public void update() { - super.update(); -// this.persistentType.update(this.classFile.getType()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java deleted file mode 100644 index 274a2fe0bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.Column - */ -public final class BinaryColumnAnnotation - extends BinaryCompleteColumnAnnotation - implements ColumnAnnotation -{ - - public BinaryColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA.COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA.COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA.COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA.COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA.COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA.COLUMN__UPDATABLE; - } - - - // ********** BinaryCompleteColumnAnnotation implementation ********** - - @Override - protected String getLengthElementName() { - return JPA.COLUMN__LENGTH; - } - - @Override - protected String getPrecisionElementName() { - return JPA.COLUMN__PRECISION; - } - - @Override - protected String getScaleElementName() { - return JPA.COLUMN__SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java deleted file mode 100644 index d922693f4e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.CompleteColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * Abstract implementation of ColumnAnnotation to be used for JPA annotations: - * javax.persistence.Column - * javax.persistence.MapKeyColumn - */ -public abstract class BinaryCompleteColumnAnnotation - extends BinaryBaseColumnAnnotation - implements CompleteColumnAnnotation -{ - protected Integer length; - protected Integer precision; - protected Integer scale; - - - protected BinaryCompleteColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.length = this.buildLength(); - this.precision = this.buildPrecision(); - this.scale = this.buildScale(); - } - - @Override - public void update() { - super.update(); - this.setLength_(this.buildLength()); - this.setPrecision_(this.buildPrecision()); - this.setScale_(this.buildScale()); - } - - - // ********** ColumnAnnotation implementation ********** - - // ***** length - public Integer getLength() { - return this.length; - } - - public void setLength(Integer length) { - throw new UnsupportedOperationException(); - } - - private void setLength_(Integer length) { - Integer old = this.length; - this.length = length; - this.firePropertyChanged(LENGTH_PROPERTY, old, length); - } - - private Integer buildLength() { - return (Integer) this.getJdtMemberValue(this.getLengthElementName()); - } - - public TextRange getLengthTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - protected abstract String getLengthElementName(); - - // ***** precision - public Integer getPrecision() { - return this.precision; - } - - public void setPrecision(Integer precision) { - throw new UnsupportedOperationException(); - } - - private void setPrecision_(Integer precision) { - Integer old = this.precision; - this.precision = precision; - this.firePropertyChanged(PRECISION_PROPERTY, old, precision); - } - - private Integer buildPrecision() { - return (Integer) this.getJdtMemberValue(this.getPrecisionElementName()); - } - - public TextRange getPrecisionTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - protected abstract String getPrecisionElementName(); - - // ***** scale - public Integer getScale() { - return this.scale; - } - - public void setScale(Integer scale) { - throw new UnsupportedOperationException(); - } - - private void setScale_(Integer scale) { - Integer old = this.scale; - this.scale = scale; - this.firePropertyChanged(SCALE_PROPERTY, old, scale); - } - - private Integer buildScale() { - return (Integer) this.getJdtMemberValue(this.getScaleElementName()); - } - - public TextRange getScaleTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - protected abstract String getScaleElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java deleted file mode 100644 index 3f284b73d4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jpt.core.resource.java.ContainerAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; - -/** - * JAR annotations do not support most of the container annotation protocol. - */ -public abstract class BinaryContainerAnnotation<T extends NestableAnnotation> - extends BinaryAnnotation - implements ContainerAnnotation<T> -{ - - protected BinaryContainerAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getElementName() { - throw new UnsupportedOperationException(); - } - - public String getNestedAnnotationName() { - throw new UnsupportedOperationException(); - } - - public T addNestedAnnotation() { - throw new UnsupportedOperationException(); - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - throw new UnsupportedOperationException(); - } - - public T moveNestedAnnotation(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public T removeNestedAnnotation(int index) { - throw new UnsupportedOperationException(); - } - - public void syncRemoveNestedAnnotations(int index) { - throw new UnsupportedOperationException(); - } - - public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) { - throw new UnsupportedOperationException(); - } - - public void addNestedAnnotation(int index, NestableAnnotation annotation) { - throw new UnsupportedOperationException(); - } - - public void convertLastNestedAnnotationToStandAlone() { - throw new UnsupportedOperationException(); - } - - public void removeLastNestedAnnotation() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java deleted file mode 100644 index ea3b6ce596..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation; -import org.eclipse.jpt.core.resource.java.DiscriminatorType; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.DiscriminatorColumn - */ -public final class BinaryDiscriminatorColumnAnnotation - extends BinaryNamedColumnAnnotation - implements DiscriminatorColumnAnnotation -{ - private DiscriminatorType discriminatorType; - private Integer length; - - - public BinaryDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.discriminatorType = this.buildDiscriminatorType(); - this.length = this.buildLength(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setDiscriminatorType_(this.buildDiscriminatorType()); - this.setLength_(this.buildLength()); - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.DISCRIMINATOR_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION; - } - - - // ********** DiscriminatorColumnAnnotation implementation ********** - - // ***** discriminator type - public DiscriminatorType getDiscriminatorType() { - return null; - } - - public void setDiscriminatorType(DiscriminatorType discriminatorType) { - throw new UnsupportedOperationException(); - } - - private void setDiscriminatorType_(DiscriminatorType discriminatorType) { - DiscriminatorType old = this.discriminatorType; - this.discriminatorType = discriminatorType; - this.firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType); - } - - private DiscriminatorType buildDiscriminatorType() { - return DiscriminatorType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE)); - } - - // ***** length - public Integer getLength() { - return null; - } - - public void setLength(Integer length) { - throw new UnsupportedOperationException(); - } - - private void setLength_(Integer length) { - Integer old = this.length; - this.length = length; - this.firePropertyChanged(LENGTH_PROPERTY, old, length); - } - - private Integer buildLength() { - return (Integer) this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__LENGTH); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java deleted file mode 100644 index e5a012d591..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.DiscriminatorValue - */ -public final class BinaryDiscriminatorValueAnnotation - extends BinaryAnnotation - implements DiscriminatorValueAnnotation -{ - private String value; - - - public BinaryDiscriminatorValueAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** DiscriminatorValueAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA.DISCRIMINATOR_VALUE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java deleted file mode 100644 index 91db09f2a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Embeddable - */ -public final class BinaryEmbeddableAnnotation - extends BinaryAnnotation - implements EmbeddableAnnotation -{ - - public BinaryEmbeddableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java deleted file mode 100644 index 2fd143485d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Embedded - */ -public final class BinaryEmbeddedAnnotation - extends BinaryAnnotation - implements EmbeddedAnnotation -{ - - public BinaryEmbeddedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java deleted file mode 100644 index 604f5be572..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.EmbeddedId - */ -public final class BinaryEmbeddedIdAnnotation - extends BinaryAnnotation - implements EmbeddedIdAnnotation -{ - - public BinaryEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java deleted file mode 100644 index f75a784870..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Entity - */ -public final class BinaryEntityAnnotation - extends BinaryAnnotation - implements EntityAnnotation -{ - private String name; - - - public BinaryEntityAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** EntityAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JPA.ENTITY__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java deleted file mode 100644 index 08ffef0291..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Enumerated - */ -public final class BinaryEnumeratedAnnotation - extends BinaryBaseEnumeratedAnnotation - implements EnumeratedAnnotation -{ - - public BinaryEnumeratedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA.ENUMERATED__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java deleted file mode 100644 index 9197dda6f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.core.resource.java.GenerationType; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.GeneratedValue - */ -public final class BinaryGeneratedValueAnnotation - extends BinaryAnnotation - implements GeneratedValueAnnotation -{ - private GenerationType strategy; - private String generator; - - - public BinaryGeneratedValueAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.strategy = this.buildStrategy(); - this.generator = this.buildGenerator(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setStrategy_(this.buildStrategy()); - this.setGenerator_(this.buildGenerator()); - } - - - // ********** GeneratedValueAnnotation implementation ********** - - // ***** strategy - public GenerationType getStrategy() { - return this.strategy; - } - - public void setStrategy(GenerationType strategy) { - throw new UnsupportedOperationException(); - } - - private void setStrategy_(GenerationType strategy) { - GenerationType old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - private GenerationType buildStrategy() { - return GenerationType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.GENERATED_VALUE__STRATEGY)); - } - - public TextRange getStrategyTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** generator - public String getGenerator() { - return this.generator; - } - - public void setGenerator(String generator) { - throw new UnsupportedOperationException(); - } - - private void setGenerator_(String generator) { - String old = this.generator; - this.generator = generator; - this.firePropertyChanged(GENERATOR_PROPERTY, old, generator); - } - - private String buildGenerator() { - return (String) this.getJdtMemberValue(JPA.GENERATED_VALUE__GENERATOR); - } - - public TextRange getGeneratorTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean generatorTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java deleted file mode 100644 index 83bf6497fb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.GeneratorAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.SequenceGenerator - * javax.persistence.TableGenerator - */ -abstract class BinaryGeneratorAnnotation - extends BinaryAnnotation - implements GeneratorAnnotation -{ - String name; - Integer initialValue; - Integer allocationSize; - - - BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.initialValue = this.buildInitialValue(); - this.allocationSize = this.buildAllocationSize(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setInitialValue_(this.buildInitialValue()); - this.setAllocationSize_(this.buildAllocationSize()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** GeneratorAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - abstract String getNameElementName(); - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** initial value - public Integer getInitialValue() { - return this.initialValue; - } - - public void setInitialValue(Integer initialValue) { - throw new UnsupportedOperationException(); - } - - private void setInitialValue_(Integer initialValue) { - Integer old = this.initialValue; - this.initialValue = initialValue; - this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue); - } - - private Integer buildInitialValue() { - return (Integer) this.getJdtMemberValue(this.getInitialValueElementName()); - } - - abstract String getInitialValueElementName(); - - public TextRange getInitialValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** name - public Integer getAllocationSize() { - return this.allocationSize; - } - - public void setAllocationSize(Integer allocationSize) { - throw new UnsupportedOperationException(); - } - - private void setAllocationSize_(Integer allocationSize) { - Integer old = this.allocationSize; - this.allocationSize = allocationSize; - this.firePropertyChanged(NAME_PROPERTY, old, allocationSize); - } - - private Integer buildAllocationSize() { - return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName()); - } - - abstract String getAllocationSizeElementName(); - - public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java deleted file mode 100644 index 95946b447e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.IdAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Id - */ -public final class BinaryIdAnnotation - extends BinaryAnnotation - implements IdAnnotation -{ - - public BinaryIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java deleted file mode 100644 index bb3b392a11..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.IdClassAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.IdClass - */ -public final class BinaryIdClassAnnotation - extends BinaryAnnotation - implements IdClassAnnotation -{ - private String value; - - - public BinaryIdClassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** IdClassAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA.ID_CLASS__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java deleted file mode 100644 index e51c45ba76..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.InheritanceAnnotation; -import org.eclipse.jpt.core.resource.java.InheritanceType; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Inheritance - */ -public final class BinaryInheritanceAnnotation - extends BinaryAnnotation - implements InheritanceAnnotation -{ - private InheritanceType strategy; - - - public BinaryInheritanceAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.strategy = this.buildStrategy(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setStrategy_(this.buildStrategy()); - } - - - // ********** InheritanceAnnotation implementation ********** - - // ***** strategy - public InheritanceType getStrategy() { - return this.strategy; - } - - public void setStrategy(InheritanceType strategy) { - throw new UnsupportedOperationException(); - } - - private void setStrategy_(InheritanceType strategy) { - InheritanceType old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - private InheritanceType buildStrategy() { - return InheritanceType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.INHERITANCE__STRATEGY)); - } - - public TextRange getStrategyTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java deleted file mode 100644 index f78bbe483e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation; - -/** - * javax.persistence.JoinColumn - */ -public final class BinaryJoinColumnAnnotation - extends BinaryBaseJoinColumnAnnotation - implements NestableJoinColumnAnnotation -{ - - public BinaryJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA.JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA.JOIN_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA.JOIN_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA.JOIN_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA.JOIN_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA.JOIN_COLUMN__UPDATABLE; - } - - - // ********** BinaryBaseJoinColumnAnnotation implementation ********** - - @Override - protected String getReferencedColumnNameElementName() { - return JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java deleted file mode 100644 index 28a12e517d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation; -import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.JoinColumns - */ -public final class BinaryJoinColumnsAnnotation - extends BinaryContainerAnnotation<NestableJoinColumnAnnotation> - implements JoinColumnsAnnotation -{ - private final Vector<NestableJoinColumnAnnotation> joinColumns; - - - public BinaryJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinColumns = this.buildJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns); - } - - public int getNestedAnnotationsSize() { - return this.joinColumns.size(); - } - - private Vector<NestableJoinColumnAnnotation> buildJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_COLUMNS__VALUE); - Vector<NestableJoinColumnAnnotation> result = new Vector<NestableJoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateJoinColumns(); - } - - // TODO - private void updateJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java deleted file mode 100644 index 12957724d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.JoinTable - */ -public final class BinaryJoinTableAnnotation - extends BinaryBaseTableAnnotation - implements JoinTableAnnotation -{ - private final Vector<JoinColumnAnnotation> joinColumns; - private final Vector<JoinColumnAnnotation> inverseJoinColumns; - - - public BinaryJoinTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinColumns = this.buildJoinColumns(); - this.inverseJoinColumns = this.buildInverseJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateJoinColumns(); - this.updateInverseJoinColumns(); - } - - - // ********** BinaryBaseTableAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.JOIN_TABLE__NAME; - } - - @Override - protected String getSchemaElementName() { - return JPA.JOIN_TABLE__SCHEMA; - } - - @Override - protected String getCatalogElementName() { - return JPA.JOIN_TABLE__CATALOG; - } - - @Override - protected String getUniqueConstraintElementName() { - return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS; - } - - - // ********** JoinTableAnnotation implementation ********** - - // ***** join columns - public ListIterator<JoinColumnAnnotation> joinColumns() { - return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<JoinColumnAnnotation> buildJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__JOIN_COLUMNS); - Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updateJoinColumns() { - throw new UnsupportedOperationException(); - } - - - // ***** inverse join columns - public ListIterator<JoinColumnAnnotation> inverseJoinColumns() { - return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns); - } - - public int inverseJoinColumnsSize() { - return this.inverseJoinColumns.size(); - } - - public JoinColumnAnnotation inverseJoinColumnAt(int index) { - return this.inverseJoinColumns.get(index); - } - - public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) { - return this.inverseJoinColumns.indexOf(joinColumn); - } - - public JoinColumnAnnotation addInverseJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveInverseJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeInverseJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<JoinColumnAnnotation> buildInverseJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS); - Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updateInverseJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java deleted file mode 100644 index 0936195b51..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.LobAnnotation; - -/** - * javax.persistence.Lob - */ -public final class BinaryLobAnnotation - extends BinaryAnnotation - implements LobAnnotation -{ - public BinaryLobAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java deleted file mode 100644 index 2508759c2c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.jpa2.resource.java.ManyToMany2_0Annotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.ManyToMany - */ -public final class BinaryManyToManyAnnotation - extends BinaryRelationshipMappingAnnotation - implements ManyToMany2_0Annotation -{ - private String mappedBy; - - - public BinaryManyToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.mappedBy = this.buildMappedBy(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setMappedBy_(this.buildMappedBy()); - } - - - // ********** BinaryRelationshipMappingAnnotation implementation ********** - - @Override - String getTargetEntityElementName() { - return JPA.MANY_TO_MANY__TARGET_ENTITY; - } - - @Override - String getFetchElementName() { - return JPA.MANY_TO_MANY__FETCH; - } - - @Override - String getCascadeElementName() { - return JPA.MANY_TO_MANY__CASCADE; - } - - - //**************** OwnableRelationshipMappingAnnotation implementation ************** - - // ***** mapped by - public String getMappedBy() { - return this.mappedBy; - } - - public void setMappedBy(String mappedBy) { - throw new UnsupportedOperationException(); - } - - private void setMappedBy_(String mappedBy) { - String old = this.mappedBy; - this.mappedBy = mappedBy; - this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy); - } - - private String buildMappedBy() { - return (String) this.getJdtMemberValue(JPA.MANY_TO_MANY__MAPPED_BY); - } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean mappedByTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java deleted file mode 100644 index bfc30b7bf9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.jpa2.resource.java.ManyToOne2_0Annotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.ManyToOne - */ -public final class BinaryManyToOneAnnotation - extends BinaryRelationshipMappingAnnotation - implements ManyToOne2_0Annotation -{ - private Boolean optional; - - - public BinaryManyToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.optional = this.buildOptional(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setOptional_(this.buildOptional()); - } - - - // ********** BinaryRelationshipMappingAnnotation implementation ********** - - @Override - String getTargetEntityElementName() { - return JPA.MANY_TO_ONE__TARGET_ENTITY; - } - - @Override - String getFetchElementName() { - return JPA.MANY_TO_ONE__FETCH; - } - - @Override - String getCascadeElementName() { - return JPA.MANY_TO_ONE__CASCADE; - } - - - // ********** ManyToOneMappingAnnotation implementation ********** - - // ***** optional - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - throw new UnsupportedOperationException(); - } - - private void setOptional_(Boolean optional) { - Boolean old = this.optional; - this.optional = optional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional); - } - - private Boolean buildOptional() { - return (Boolean) this.getJdtMemberValue(JPA.MANY_TO_ONE__OPTIONAL); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java deleted file mode 100644 index 3430106e66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.MapKeyAnnotation; - -/** - * javax.persistence.MapKey - */ -public final class BinaryMapKeyAnnotation - extends BinaryAnnotation - implements MapKeyAnnotation -{ - private String name; - - - public BinaryMapKeyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** MapKeyAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JPA.MAP_KEY__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java deleted file mode 100644 index 419bfaaa06..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; - -public final class BinaryMappedSuperclassAnnotation - extends BinaryAnnotation - implements MappedSuperclassAnnotation -{ - public BinaryMappedSuperclassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java deleted file mode 100644 index 1b4e0ce720..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation; - -/** - * javax.persistence.Column - * javax.persistence.JoinColumn - * javax.persistence.DiscriminatorColumn - * javax.persistence.PrimaryKeyJoinColumn. - */ -public abstract class BinaryNamedColumnAnnotation - extends BinaryAnnotation - implements NamedColumnAnnotation -{ - private String name; - private String columnDefinition; - - - protected BinaryNamedColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.columnDefinition = this.buildColumnDefinition(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setColumnDefinition_(this.buildColumnDefinition()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** NamedColumn implementation ********** - - public boolean isSpecified() { - return true; - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - protected abstract String getNameElementName(); - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** column definition - public String getColumnDefinition() { - return null; - } - - public void setColumnDefinition(String columnDefinition) { - throw new UnsupportedOperationException(); - } - - private void setColumnDefinition_(String columnDefinition) { - String old = this.columnDefinition; - this.columnDefinition = columnDefinition; - this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition); - } - - private String buildColumnDefinition() { - return (String) this.getJdtMemberValue(this.getColumnDefinitionElementName()); - } - - protected abstract String getColumnDefinitionElementName(); - - public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java deleted file mode 100644 index 8f8a12d239..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation; -import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.NamedNativeQueries - */ -public final class BinaryNamedNativeQueriesAnnotation - extends BinaryContainerAnnotation<NestableNamedNativeQueryAnnotation> - implements NamedNativeQueriesAnnotation -{ - private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries; - - - public BinaryNamedNativeQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.namedNativeQueries = this.buildNamedNativeQueries(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableNamedNativeQueryAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries); - } - - public int getNestedAnnotationsSize() { - return this.namedNativeQueries.size(); - } - - private Vector<NestableNamedNativeQueryAnnotation> buildNamedNativeQueries() { - Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_NATIVE_QUERIES__VALUE); - Vector<NestableNamedNativeQueryAnnotation> result = new Vector<NestableNamedNativeQueryAnnotation>(jdtQueries.length); - for (Object jdtQuery : jdtQueries) { - result.add(new BinaryNamedNativeQueryAnnotation(this, (IAnnotation) jdtQuery)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateNamedNativeQueries(); - } - - // TODO - private void updateNamedNativeQueries() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java deleted file mode 100644 index f1fb402d89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation; - -/** - * javax.persistence.NamedNativeQuery - */ -public final class BinaryNamedNativeQueryAnnotation - extends BinaryQueryAnnotation - implements NestableNamedNativeQueryAnnotation -{ - private String resultClass; - private String resultSetMapping; - - - public BinaryNamedNativeQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.resultClass = this.buildResultClass(); - this.resultSetMapping = this.buildResultSetMapping(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setResultClass_(this.buildResultClass()); - this.setResultSetMapping_(this.buildResultSetMapping()); - } - - - // ********** BinaryBaseNamedQueryAnnotation implementation ********** - - @Override - String getNameElementName() { - return JPA.NAMED_NATIVE_QUERY__NAME; - } - - @Override - String getQueryElementName() { - return JPA.NAMED_NATIVE_QUERY__QUERY; - } - - @Override - String getHintsElementName() { - return JPA.NAMED_NATIVE_QUERY__HINTS; - } - - - // ********** NamedNativeQueryAnnotation implementation ********** - - // ***** result class - public String getResultClass() { - return this.resultClass; - } - - public void setResultClass(String resultClass) { - throw new UnsupportedOperationException(); - } - - private void setResultClass_(String resultClass) { - String old = this.resultClass; - this.resultClass = resultClass; - this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass); - } - - private String buildResultClass() { - return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS); - } - - public TextRange getResultClassTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified result class name - public String getFullyQualifiedResultClassName() { - return this.resultClass; - } - - // ***** result set mapping - public String getResultSetMapping() { - return this.resultSetMapping; - } - - public void setResultSetMapping(String resultSetMapping) { - throw new UnsupportedOperationException(); - } - - private void setResultSetMapping_(String resultSetMapping) { - String old = this.resultSetMapping; - this.resultSetMapping = resultSetMapping; - this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping); - } - - private String buildResultSetMapping() { - return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS); - } - - public TextRange getResultSetMappingTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java deleted file mode 100644 index 810cbe93fe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation; -import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.NamedQueries - */ -public abstract class BinaryNamedQueriesAnnotation - extends BinaryContainerAnnotation<NestableNamedQueryAnnotation> - implements NamedQueriesAnnotation -{ - private final Vector<NestableNamedQueryAnnotation> namedQueries; - - - public BinaryNamedQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.namedQueries = this.buildNamedQueries(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableNamedQueryAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableNamedQueryAnnotation>(this.namedQueries); - } - - public int getNestedAnnotationsSize() { - return this.namedQueries.size(); - } - - private Vector<NestableNamedQueryAnnotation> buildNamedQueries() { - Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_QUERIES__VALUE); - Vector<NestableNamedQueryAnnotation> result = new Vector<NestableNamedQueryAnnotation>(jdtQueries.length); - for (Object jdtQuery : jdtQueries) { - result.add(this.buildNamedQuery(jdtQuery)); - } - return result; - } - - protected abstract NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery); - - @Override - public void update() { - super.update(); - this.updateNamedQueries(); - } - - // TODO - private void updateNamedQueries() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java deleted file mode 100644 index d04eaa000e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation; - -/** - * javax.persistence.NamedQuery - */ -public abstract class BinaryNamedQueryAnnotation - extends BinaryQueryAnnotation - implements NestableNamedQueryAnnotation -{ - public BinaryNamedQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryBaseNamedQueryAnnotation implementation ********** - - @Override - String getNameElementName() { - return JPA.NAMED_QUERY__NAME; - } - - @Override - String getQueryElementName() { - return JPA.NAMED_QUERY__QUERY; - } - - @Override - String getHintsElementName() { - return JPA.NAMED_QUERY__HINTS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java deleted file mode 100644 index 0979bb31d8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; - -/** - * Binary convenience methods - */ -// TODO hopefully this class can go away with some sort of refactoring of the -// source and binary hierarchies... -public abstract class BinaryNode - extends AbstractJavaResourceNode -{ - - // ********** construction ********** - - protected BinaryNode(JavaResourceNode parent) { - super(parent); - } - - - // ********** JavaResourceNode implementation ********** - - @Override - public IFile getFile() { - return null; // only BinaryPackageFragmentRoot has a file... - } - - public void update() { - // nothing by default - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void initialize(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java deleted file mode 100644 index 213acacc55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OneToMany - */ -public final class BinaryOneToManyAnnotation - extends BinaryRelationshipMappingAnnotation - implements OneToMany2_0Annotation -{ - private String mappedBy; - - private Boolean orphanRemoval; //added in JPA 2.0 - - public BinaryOneToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.mappedBy = this.buildMappedBy(); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setMappedBy_(this.buildMappedBy()); - this.setOrphanRemoval_(this.buildOrphanRemoval()); - } - - - // ********** BinaryRelationshipMappingAnnotation implementation ********** - - @Override - String getTargetEntityElementName() { - return JPA.ONE_TO_MANY__TARGET_ENTITY; - } - - @Override - String getFetchElementName() { - return JPA.ONE_TO_MANY__FETCH; - } - - @Override - String getCascadeElementName() { - return JPA.ONE_TO_MANY__CASCADE; - } - - - //**************** OwnableRelationshipMappingAnnotation implementation ************** - - // ***** mapped by - public String getMappedBy() { - return this.mappedBy; - } - - public void setMappedBy(String mappedBy) { - throw new UnsupportedOperationException(); - } - - private void setMappedBy_(String mappedBy) { - String old = this.mappedBy; - this.mappedBy = mappedBy; - this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy); - } - - private String buildMappedBy() { - return (String) this.getJdtMemberValue(JPA.ONE_TO_MANY__MAPPED_BY); - } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean mappedByTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ********** OneToMany2_0Annotation implementation ********** - - public Boolean getOrphanRemoval() { - return this.orphanRemoval; - } - - public void setOrphanRemoval(Boolean orphanRemoval) { - throw new UnsupportedOperationException(); - } - - public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - private Boolean buildOrphanRemoval() { - return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL); - } - - private void setOrphanRemoval_(Boolean orphanRemoval) { - Boolean old = this.orphanRemoval; - this.orphanRemoval = orphanRemoval; - this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java deleted file mode 100644 index e4961ffffa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OneToOne - */ -public class BinaryOneToOneAnnotation - extends BinaryRelationshipMappingAnnotation - implements OneToOne2_0Annotation -{ - private Boolean optional; - private String mappedBy; - private Boolean orphanRemoval; //added in JPA 2.0 - - public BinaryOneToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.optional = this.buildOptional(); - this.mappedBy = this.buildMappedBy(); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setOptional_(this.buildOptional()); - this.setMappedBy_(this.buildMappedBy()); - this.setOrphanRemoval_(this.buildOrphanRemoval()); - } - - - // ********** BinaryRelationshipMappingAnnotation implementation ********** - - @Override - String getTargetEntityElementName() { - return JPA.ONE_TO_ONE__TARGET_ENTITY; - } - - @Override - String getFetchElementName() { - return JPA.ONE_TO_ONE__FETCH; - } - - @Override - String getCascadeElementName() { - return JPA.ONE_TO_ONE__CASCADE; - } - - - //**************** OwnableRelationshipMappingAnnotation implementation ************** - - // ***** mapped by - public String getMappedBy() { - return this.mappedBy; - } - - public void setMappedBy(String mappedBy) { - throw new UnsupportedOperationException(); - } - - private void setMappedBy_(String mappedBy) { - String old = this.mappedBy; - this.mappedBy = mappedBy; - this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy); - } - - private String buildMappedBy() { - return (String) this.getJdtMemberValue(JPA.ONE_TO_ONE__MAPPED_BY); - } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean mappedByTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - //**************** OneToOneAnnotation implementation ************** - - // ***** optional - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - throw new UnsupportedOperationException(); - } - - private void setOptional_(Boolean optional) { - Boolean old = this.optional; - this.optional = optional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional); - } - - private Boolean buildOptional() { - return (Boolean) this.getJdtMemberValue(JPA.ONE_TO_ONE__OPTIONAL); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ********** OneToOne2_0Annotation implementation ********** - - public Boolean getOrphanRemoval() { - return this.orphanRemoval; - } - - public void setOrphanRemoval(Boolean orphanRemoval) { - throw new UnsupportedOperationException(); - } - - public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - private Boolean buildOrphanRemoval() { - return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL); - } - - private void setOrphanRemoval_(Boolean orphanRemoval) { - Boolean old = this.orphanRemoval; - this.orphanRemoval = orphanRemoval; - this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java deleted file mode 100644 index 38329f78a1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.OrderByAnnotation; - -/** - * javax.persistence.OrderBy - */ -public final class BinaryOrderByAnnotation - extends BinaryAnnotation - implements OrderByAnnotation -{ - private String value; - - - public BinaryOrderByAnnotation(JavaResourcePersistentAttribute parent, IAnnotation annotation) { - super(parent, annotation); - this.value = this.buildValue(); - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** OrderByAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA.ORDER_BY__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java deleted file mode 100644 index 394d26045c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.OverrideAnnotation; - -/** - * Common behavior for - * javax.persistence.AttributeOverride - * javax.persistence.AssociationOverride - */ -public abstract class BinaryOverrideAnnotation - extends BinaryAnnotation - implements OverrideAnnotation -{ - private String name; - - - public BinaryOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** OverrideAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - protected abstract String getNameElementName(); - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java deleted file mode 100644 index 734439b56d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.resource.java.JavaResourceClassFile; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; - -/** - * binary package fragment - */ -final class BinaryPackageFragment - extends BinaryNode - implements JavaResourcePackageFragment -{ - /** JDT package fragment */ - private final IPackageFragment packageFragment; - - /** - * class files in the package fragment; - * we only hold class files/types that are actually annotated; - * if the unannotated types are needed (e.g. for orm.xml or an - * inheritance tree) they can be discovered on the classpath as needed - */ - private final Vector<JavaResourceClassFile> classFiles = new Vector<JavaResourceClassFile>(); - - - // ********** construction/initialization ********** - - BinaryPackageFragment(JavaResourcePackageFragmentRoot parent, IPackageFragment packageFragment) { - super(parent); - this.packageFragment = packageFragment; - this.classFiles.addAll(this.buildClassFiles()); - } - - private Collection<JavaResourceClassFile> buildClassFiles() { - IJavaElement[] children = this.getJDTChildren(); - ArrayList<JavaResourceClassFile> result = new ArrayList<JavaResourceClassFile>(children.length); - for (IJavaElement child : children) { - IClassFile jdtClassFile = (IClassFile) child; - IType jdtType = jdtClassFile.getType(); - if (BinaryPersistentType.typeIsPersistable(jdtType)) { - JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType); - if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types - result.add(classFile); - } - } - } - return result; - } - - - // ********** JarResourceNode implementation ********** - - @Override - public void update() { - super.update(); - this.updateClassFiles(); - } - - // TODO - private void updateClassFiles() { - throw new UnsupportedOperationException(); - } - - - // ********** JavaResourcePackageFragment implementation ********** - - public ListIterator<JavaResourceClassFile> classFiles() { - return new CloneListIterator<JavaResourceClassFile>(this.classFiles); - } - - public int classFilesSize() { - return this.classFiles.size(); - } - - public Iterator<JavaResourcePersistentType> persistedTypes() { - return new TransformationIterator<JavaResourceClassFile, JavaResourcePersistentType>(this.classFiles()) { - @Override - protected JavaResourcePersistentType transform(JavaResourceClassFile classFile) { - return classFile.getPersistentType(); // we only hold annotated types - } - }; - } - - - // ********** misc ********** - - private IJavaElement[] getJDTChildren() { - try { - return this.packageFragment.getChildren(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_JAVA_ELEMENT_ARRAY; - } - } - protected static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0]; - - @Override - public void toString(StringBuilder sb) { - sb.append(this.packageFragment.getElementName()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java deleted file mode 100644 index ea9fdc5268..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.core.JpaAnnotationProvider; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; - -/** - * binary package fragment root - */ -public final class BinaryPackageFragmentRoot - extends RootBinaryNode - implements JavaResourcePackageFragmentRoot -{ - /** JDT package fragment root */ - private final IPackageFragmentRoot packageFragmentRoot; - - /** package fragments in the JAR */ - private final Vector<JavaResourcePackageFragment> packageFragments = new Vector<JavaResourcePackageFragment>(); - - - // ********** construction/initialization ********** - - public BinaryPackageFragmentRoot(IPackageFragmentRoot packageFragmentRoot, JpaAnnotationProvider annotationProvider) { - super(null, annotationProvider); // the package fragment root is the root of its sub-tree - this.packageFragmentRoot = packageFragmentRoot; - this.packageFragments.addAll(this.buildPackageFragments()); - } - - private Collection<JavaResourcePackageFragment> buildPackageFragments() { - IJavaElement[] jdtChildren = this.getJDTChildren(); - ArrayList<JavaResourcePackageFragment> result = new ArrayList<JavaResourcePackageFragment>(jdtChildren.length); - for (IJavaElement child : jdtChildren) { - result.add(new BinaryPackageFragment(this, (IPackageFragment) child)); - } - return result; - } - - - // ********** overrides ********** - - @Override - public IFile getFile() { - return (IFile) this.packageFragmentRoot.getResource(); - } - - @Override - public void update() { - super.update(); - this.updatePackageFragments(); - } - - // TODO - private void updatePackageFragments() { - throw new UnsupportedOperationException(); - } - - - // ********** JavaResourceNode.Root implementation ********** - - /** - * NB: we hold only annotated types - */ - public Iterator<JavaResourcePersistentType> persistentTypes() { - return new CompositeIterator<JavaResourcePersistentType>(this.persistedTypesLists()); - } - - private Iterator<Iterator<JavaResourcePersistentType>> persistedTypesLists() { - return new TransformationIterator<JavaResourcePackageFragment, Iterator<JavaResourcePersistentType>>(this.packageFragments()) { - @Override - protected Iterator<JavaResourcePersistentType> transform(JavaResourcePackageFragment fragment) { - return fragment.persistedTypes(); - } - }; - } - - - // ********** JavaResourcePackageFragmentRoot implementation ********** - - public Iterator<JavaResourcePackageFragment> packageFragments() { - return new CloneIterator<JavaResourcePackageFragment>(this.packageFragments); - } - - public int packageFragmentsSize() { - return this.packageFragments.size(); - } - - - // ********** misc ********** - - private IJavaElement[] getJDTChildren() { - return JDTTools.getJDTChildren(this.packageFragmentRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java deleted file mode 100644 index 6b579e93c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java +++ /dev/null @@ -1,657 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.core.resource.java.AccessType; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.utility.MethodSignature; -import org.eclipse.jpt.utility.internal.ClassName; -import org.eclipse.jpt.utility.internal.NameTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * binary persistent attribute (field or property) - */ -final class BinaryPersistentAttribute - extends BinaryPersistentMember - implements JavaResourcePersistentAttribute -{ - private int modifiers; - - private String typeName; - - private boolean typeIsInterface; - - private boolean typeIsEnum; - - private final Vector<String> typeSuperclassNames = new Vector<String>(); - - private final Vector<String> typeInterfaceNames = new Vector<String>(); - - private final Vector<String> typeTypeArgumentNames = new Vector<String>(); - - - BinaryPersistentAttribute(JavaResourcePersistentType parent, IField field) { - this(parent, new FieldAdapter(field)); - } - - BinaryPersistentAttribute(JavaResourcePersistentType parent, IMethod method) { - this(parent, new MethodAdapter(method)); - } - - private BinaryPersistentAttribute(JavaResourcePersistentType parent, Adapter adapter) { - super(parent, adapter); - this.modifiers = this.buildModifiers(); - this.typeName = this.buildTypeName(); - - IType type = this.getType(); // shouldn't be an array... - this.typeIsInterface = this.buildTypeIsInterface(type); - this.typeIsEnum = this.buildTypeIsEnum(type); - this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(type)); - this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(type)); - - this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames()); - } - - - // ******** overrides ******** - - @Override - public void update() { - super.update(); - this.setModifiers(this.buildModifiers()); - this.setTypeName(this.buildTypeName()); - - IType type = this.getType(); // shouldn't be an array... - this.setTypeIsInterface(this.buildTypeIsInterface(type)); - this.setTypeIsEnum(this.buildTypeIsEnum(type)); - this.setTypeSuperclassNames(this.buildTypeSuperclassNames(type)); - this.setTypeInterfaceNames(this.buildTypeInterfaceNames(type)); - - this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ********** BinaryPersistentMember implementation ********** - - private Adapter getAdapter() { - return (Adapter) this.adapter; - } - - @Override - Iterator<String> validAnnotationNames() { - return this.getAnnotationProvider().attributeAnnotationNames(); - } - - @Override - Annotation buildAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildAttributeAnnotation(this, jdtAnnotation); - } - - Annotation buildNullAnnotation_(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName); - } - - - // ********** JavaResourcePersistentAttribute implementation ********** - - @Override - public JavaResourcePersistentType getParent() { - return (JavaResourcePersistentType) super.getParent(); - } - - public JavaResourcePersistentType getResourcePersistentType() { - return this.getParent(); - } - - public String getName() { - return this.getAdapter().getAttributeName(); - } - - @Override - public Annotation buildNullAnnotation(String annotationName) { - return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName); - } - - public boolean isField() { - return this.getAdapter().isField(); - } - - public boolean isProperty() { - return ! this.isField(); - } - - public boolean isFor(MethodSignature methodSignature, int occurrence) { - throw new UnsupportedOperationException(); - } - - public AccessType getSpecifiedAccess() { - Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME); - return accessAnnotation == null ? null : accessAnnotation.getValue(); - } - - public boolean typeIsSubTypeOf(String tn) { - return ((this.typeName != null) && this.typeName.equals(tn)) - || this.typeInterfaceNames.contains(tn) - || this.typeSuperclassNames.contains(tn); - } - - public boolean typeIsVariablePrimitive() { - return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName); - } - - // ***** modifiers - public int getModifiers() { - return this.modifiers; - } - - private void setModifiers(int modifiers) { - int old = this.modifiers; - this.modifiers = modifiers; - this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers); - } - - /** - * zero seems like a reasonable default... - */ - private int buildModifiers() { - try { - return this.getMember().getFlags(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return 0; - } - } - - // ***** type name - public String getTypeName() { - return this.typeName; - } - - private void setTypeName(String typeName) { - String old = this.typeName; - this.typeName = typeName; - this.firePropertyChanged(TYPE_NAME_PROPERTY, old, typeName); - } - - /** - * JARs don't have array types; - * also, no generic type parameters - */ - private String buildTypeName() { - return convertTypeSignatureToTypeName(this.getTypeSignature()); - } - - // ***** type is interface - public boolean typeIsInterface() { - return this.typeIsInterface; - } - - private void setTypeIsInterface(boolean typeIsInterface) { - boolean old = this.typeIsInterface; - this.typeIsInterface = typeIsInterface; - this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, typeIsInterface); - } - - private boolean buildTypeIsInterface(IType type) { - try { - return (type != null) && type.isInterface(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - // ***** type is enum - public boolean typeIsEnum() { - return this.typeIsEnum; - } - - private void setTypeIsEnum(boolean typeIsEnum) { - boolean old = this.typeIsEnum; - this.typeIsEnum = typeIsEnum; - this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, typeIsEnum); - } - - private boolean buildTypeIsEnum(IType type) { - try { - return (type != null) && type.isEnum(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - // ***** type superclass hierarchy - public ListIterator<String> typeSuperclassNames() { - return new CloneListIterator<String>(this.typeSuperclassNames); - } - - public boolean typeSuperclassNamesContains(String superclassName) { - return this.typeSuperclassNames.contains(superclassName); - } - - private void setTypeSuperclassNames(List<String> typeSuperclassNames) { - this.synchronizeList(typeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST); - } - - private List<String> buildTypeSuperclassNames(IType type) { - if (type == null) { - return Collections.emptyList(); - } - - ArrayList<String> names = new ArrayList<String>(); - type = this.findSuperclass(type); - while (type != null) { - names.add(type.getFullyQualifiedName('.')); // no parameters are included here - type = this.findSuperclass(type); - } - return names; - } - - // ***** type interface hierarchy - public Iterator<String> typeInterfaceNames() { - return new CloneIterator<String>(this.typeInterfaceNames); - } - - public boolean typeInterfaceNamesContains(String interfaceName) { - return this.typeInterfaceNames.contains(interfaceName); - } - - private void setTypeInterfaceNames(Collection<String> typeInterfaceNames) { - this.synchronizeCollection(typeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION); - } - - private Collection<String> buildTypeInterfaceNames(IType type) { - if (type == null) { - return Collections.emptySet(); - } - - HashSet<String> names = new HashSet<String>(); - while (type != null) { - this.addInterfaceNamesTo(type, names); - type = this.findSuperclass(type); - } - return names; - } - - private void addInterfaceNamesTo(IType type, HashSet<String> names) { - for (String interfaceSignature : this.getSuperInterfaceTypeSignatures(type)) { - String interfaceName = convertTypeSignatureToTypeName(interfaceSignature); - names.add(interfaceName); - IType interfaceType = this.findType(interfaceName); - if (interfaceType != null) { - this.addInterfaceNamesTo(interfaceType, names); // recurse - } - } - } - - // ***** type type argument names - public ListIterator<String> typeTypeArgumentNames() { - return new CloneListIterator<String>(this.typeTypeArgumentNames); - } - - public int typeTypeArgumentNamesSize() { - return this.typeTypeArgumentNames.size(); - } - - public String getTypeTypeArgumentName(int index) { - return this.typeTypeArgumentNames.get(index); - } - - private void setTypeTypeArgumentNames(List<String> typeTypeArgumentNames) { - this.synchronizeList(typeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST); - } - - /** - * these types can be arrays (e.g. "java.lang.String[]"); - * but they won't have any further nested generic type arguments - * (e.g. "java.util.Collection<java.lang.String>") - */ - private List<String> buildTypeTypeArgumentNames() { - String typeSignature = this.getTypeSignature(); - if (typeSignature == null) { - return Collections.emptyList(); - } - - String[] typeArgumentSignatures = Signature.getTypeArguments(typeSignature); - if (typeArgumentSignatures.length == 0) { - return Collections.emptyList(); - } - - ArrayList<String> names = new ArrayList<String>(typeArgumentSignatures.length); - for (String typeArgumentSignature : typeArgumentSignatures) { - names.add(convertTypeSignatureToTypeName(typeArgumentSignature)); - } - return names; - } - - - // ********** convenience methods ********** - - private String getTypeSignature() { - try { - return this.getAdapter().getTypeSignature(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return null; - } - } - - private IType findSuperclass(IType type) { - return this.findTypeBySignature(this.getSuperclassSignature(type)); - } - - private String getSuperclassSignature(IType type) { - try { - return type.getSuperclassTypeSignature(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return null; - } - } - - private String[] getSuperInterfaceTypeSignatures(IType type) { - try { - return type.getSuperInterfaceTypeSignatures(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return StringTools.EMPTY_STRING_ARRAY; - } - } - - private IType findTypeBySignature(String typeSignature) { - return (typeSignature == null) ? null : this.findType(convertTypeSignatureToTypeName_(typeSignature)); - } - - private IType getType() { - return (this.typeName == null) ? null : this.findType(this.typeName); - } - - private IType findType(String fullyQualifiedName) { - try { - return this.getJavaProject().findType(fullyQualifiedName); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return null; - } - } - - private IJavaProject getJavaProject() { - return this.getMember().getJavaProject(); - } - - - - // ********** adapters ********** - - /** - * Adapt an IField or IMethod. - */ - interface Adapter - extends BinaryPersistentMember.Adapter - { - /** - * Return the field or getter method's "attribute" name - * (e.g. field "foo" -> "foo"; method "getFoo" -> "foo"). - */ - String getAttributeName(); - - /** - * Return whether the attribute is a Java field (as opposed to a method). - */ - boolean isField(); - - /** - * Return the attribute's type signature. - */ - String getTypeSignature() throws JavaModelException; - } - - /** - * IField adapter - */ - static class FieldAdapter - implements Adapter - { - final IField field; - - FieldAdapter(IField field) { - super(); - this.field = field; - } - - public IField getElement() { - return this.field; - } - - public boolean isPersistable() { - return this.field.exists() && JPTTools.fieldIsPersistable(new JPTToolsAdapter()); - } - - public IAnnotation[] getAnnotations() throws JavaModelException { - return this.field.getAnnotations(); - } - - public String getAttributeName() { - return this.field.getElementName(); - } - - public boolean isField() { - return true; - } - - public String getTypeSignature() throws JavaModelException { - return this.field.getTypeSignature(); - } - - /** - * JPTTools needs an adapter so it can work with either an IField - * or an IVariableBinding etc. - */ - class JPTToolsAdapter implements JPTTools.FieldAdapter { - public int getModifiers() { - try { - return FieldAdapter.this.field.getFlags(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return 0; - } - } - - } - - } - - /** - * IMethod adapter - */ - static class MethodAdapter - implements Adapter - { - final IMethod method; - static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0]; - - MethodAdapter(IMethod method) { - super(); - this.method = method; - } - - public IMethod getElement() { - return this.method; - } - - public boolean isPersistable() { - return JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter()); - } - - public IAnnotation[] getAnnotations() throws JavaModelException { - return this.method.getAnnotations(); - } - - public String getAttributeName() { - return NameTools.convertGetterSetterMethodNameToPropertyName(this.method.getElementName()); - } - - public boolean isField() { - return false; - } - - public String getTypeSignature() throws JavaModelException { - return this.method.getReturnType(); - } - - /** - * JPTTools needs an adapter so it can work with either an IMethod - * or an IMethodBinding etc. - */ - abstract static class AbstractJPTToolsAdapter - implements JPTTools.SimpleMethodAdapter - { - AbstractJPTToolsAdapter() { - super(); - } - - abstract IMethod getMethod(); - - public int getModifiers() { - try { - return this.getMethod().getFlags(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return 0; - } - } - - public String getReturnTypeErasureName() { - return convertTypeSignatureToTypeName(this.getReturnTypeSignature()); - } - - private String getReturnTypeSignature() { - try { - return this.getMethod().getReturnType(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return null; - } - } - - public boolean isConstructor() { - try { - return this.getMethod().isConstructor(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - } - - static class SimpleJPTToolsAdapter - extends AbstractJPTToolsAdapter - { - private final IMethod method; - - SimpleJPTToolsAdapter(IMethod method) { - super(); - this.method = method; - } - - @Override - IMethod getMethod() { - return this.method; - } - - } - - class JPTToolsAdapter - extends AbstractJPTToolsAdapter - implements JPTTools.MethodAdapter - { - JPTToolsAdapter() { - super(); - } - - @Override - IMethod getMethod() { - return MethodAdapter.this.method; - } - - public String getName() { - return this.getMethod().getElementName(); - } - - public int getParametersLength() { - return this.getMethod().getParameterTypes().length; - } - - public JPTTools.SimpleMethodAdapter getSibling(String name) { - for (IMethod sibling : this.getSiblings()) { - if ((sibling.getParameterTypes().length == 0) - && sibling.getElementName().equals(name)) { - return new SimpleJPTToolsAdapter(sibling); - } - } - return null; - } - - public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) { - for (IMethod sibling : this.getSiblings()) { - String[] parmTypes = sibling.getParameterTypes(); - if ((parmTypes.length == 1) - && sibling.getElementName().equals(name) - && convertTypeSignatureToTypeName(parmTypes[0]).equals(parameterTypeErasureName)) { - return new SimpleJPTToolsAdapter(sibling); - } - } - return null; - } - - private IMethod[] getSiblings() { - try { - return this.getMethod().getDeclaringType().getMethods(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_METHOD_ARRAY; - } - } - - } - - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java deleted file mode 100644 index a604e8fac8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Iterator; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.IMember; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.utility.Filter; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; - -/** - * binary persistent member - */ -abstract class BinaryPersistentMember - extends BinaryAnnotatedElement - implements JavaResourcePersistentMember -{ - - boolean persistable; - - private boolean final_; // 'final' is a reserved word - - - // ********** construction/initialization ********** - - public BinaryPersistentMember(JavaResourceNode parent, Adapter adapter) { - super(parent, adapter); - this.persistable = this.buildPersistable(); - this.final_ = this.buildFinal(); - } - - - private Adapter getAdapter() { - return (Adapter) this.adapter; - } - - // ********** updating ********** - - @Override - public void update() { - super.update(); - this.setPersistable(this.buildPersistable()); - this.setFinal(this.buildFinal()); - } - - - // ********** simple state ********** - - public boolean isPersistable() { - return this.persistable; - } - - private void setPersistable(boolean persistable) { - boolean old = this.persistable; - this.persistable = persistable; - this.firePropertyChanged(PERSISTABLE_PROPERTY, old, persistable); - } - - private boolean buildPersistable() { - return this.getAdapter().isPersistable(); - } - - // ***** final - public boolean isFinal() { - return this.final_; - } - - private void setFinal(boolean final_) { - boolean old = this.final_; - this.final_ = final_; - this.firePropertyChanged(FINAL_PROPERTY, old, final_); - } - - private boolean buildFinal() { - try { - return Flags.isFinal(this.getMember().getFlags()); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - - // ********** miscellaneous ********** - - IMember getMember() { - return (IMember) this.adapter.getElement(); - } - - /** - * convenience method - */ - <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) { - @SuppressWarnings("unchecked") - Filter<T> filter = (Filter<T>) PERSISTABLE_MEMBER_FILTER; - return new FilteringIterator<T>(members, filter); - } - - /** - * Strip off the type signature's parameters if present. - * Convert to a readable string. - */ - static String convertTypeSignatureToTypeName(String typeSignature) { - return (typeSignature == null) ? null : convertTypeSignatureToTypeName_(typeSignature); - } - - /** - * no null check - */ - static String convertTypeSignatureToTypeName_(String typeSignature) { - return Signature.toString(Signature.getTypeErasure(typeSignature)); - } - - - // ********** IMember adapter ********** - - interface Adapter extends BinaryAnnotatedElement.Adapter { - /** - * Return the adapter's JDT member (IType, IField, IMethod). - */ - IMember getElement(); - - /** - * Return whether the adapter's member is "persistable" - * (i.e. according to the JPA spec the member can be mapped) - */ - boolean isPersistable(); - } - - - // ********** unsupported JavaResourceAnnotatedElement implementation ********** - - @Override - public Annotation addAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - @Override - public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - @Override - public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - @Override - public void removeAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - @Override - public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) { - throw new UnsupportedOperationException(); - } - - @Override - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void resolveTypes(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean isFor(String memberName, int occurrence) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java deleted file mode 100644 index 20e811f4dc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java +++ /dev/null @@ -1,694 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0; -import org.eclipse.jpt.core.resource.java.AccessType; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.utility.MethodSignature; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; - -/** - * binary persistent type - */ -final class BinaryPersistentType - extends BinaryPersistentMember - implements JavaResourcePersistentType2_0 -{ - private String name; - - private String qualifiedName; - - private String packageName; - - private String superclassQualifiedName; - - private String declaringTypeName; - - private boolean abstract_; // 'abstract' is a reserved word - - private boolean static_; // 'static' is a reserved word - - private boolean memberType; - - private boolean hasPrivateNoArgConstructor; - - private boolean hasNoArgConstructor; - - private final Vector<JavaResourcePersistentAttribute> fields; - - private final Vector<JavaResourcePersistentAttribute> methods; - - - // ********** construction/initialization ********** - - BinaryPersistentType(JavaResourceNode parent, IType type) { - super(parent, new TypeAdapter(type)); - this.name = this.buildName(); - this.qualifiedName = this.buildQualifiedName(); - this.packageName = this.buildPackageName(); - this.superclassQualifiedName = this.buildSuperclassQualifiedName(); - this.declaringTypeName = this.buildDeclaringTypeName(); - this.abstract_ = this.buildAbstract(); - this.static_ = this.buildStatic(); - this.memberType = this.buildMemberType(); - this.hasNoArgConstructor = this.buildHasNoArgConstructor(); - this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(); - this.fields = this.buildFields(); - this.methods = this.buildMethods(); - } - - - // ********** overrides ********** - - @Override - public void update() { - super.update(); - this.setName(this.buildName()); - this.setQualifiedName(this.buildQualifiedName()); - this.setPackageName(this.buildPackageName()); - this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName()); - this.setDeclaringTypeName(this.buildDeclaringTypeName()); - this.setAbstract(this.buildAbstract()); - this.setStatic(this.buildStatic()); - this.setMemberType(this.buildMemberType()); - this.setHasNoArgConstructor(this.buildHasNoArgConstructor()); - this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor()); - this.updateFields(); - this.updateMethods(); - } - - // TODO - private void updateFields() { - throw new UnsupportedOperationException(); - } - - // TODO - private void updateMethods() { - throw new UnsupportedOperationException(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** BinaryPersistentMember implementation ********** - - @Override - Annotation buildAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildTypeAnnotation(this, jdtAnnotation); - } - - @Override - Annotation buildNullAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName); - } - - @Override - Iterator<String> validAnnotationNames() { - return this.getAnnotationProvider().typeAnnotationNames(); - } - - - // ********** JavaResourcePersistentType implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - private void setName(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return this.getMember().getElementName(); - } - - // ***** qualified name - public String getQualifiedName() { - return this.qualifiedName; - } - - private void setQualifiedName(String qualifiedName) { - String old = this.qualifiedName; - this.qualifiedName = qualifiedName; - this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName); - } - - private String buildQualifiedName() { - return this.getMember().getFullyQualifiedName('.'); // no parameters are included here - } - - // ***** package - public String getPackageName() { - return this.packageName; - } - - private void setPackageName(String packageName) { - String old = this.packageName; - this.packageName = packageName; - this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, packageName); - } - - private String buildPackageName() { - return this.getMember().getPackageFragment().getElementName(); - } - - public boolean isIn(IPackageFragment packageFragment) { - return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName); - } - - // ***** superclass qualified name - public String getSuperclassQualifiedName() { - return this.superclassQualifiedName; - } - - private void setSuperclassQualifiedName(String superclassQualifiedName) { - String old = this.superclassQualifiedName; - this.superclassQualifiedName = superclassQualifiedName; - this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName); - } - - private String buildSuperclassQualifiedName() { - return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature()); - } - - private String getSuperclassTypeSignature() { - try { - return this.getMember().getSuperclassTypeSignature(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return null; - } - } - - // ***** declaring type name - public String getDeclaringTypeName() { - return this.declaringTypeName; - } - - private void setDeclaringTypeName(String declaringTypeName) { - String old = this.declaringTypeName; - this.declaringTypeName = declaringTypeName; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName); - } - - private String buildDeclaringTypeName() { - IType declaringType = this.getMember().getDeclaringType(); - return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here - } - - // ***** abstract - public boolean isAbstract() { - return this.abstract_; - } - - private void setAbstract(boolean abstract_) { - boolean old = this.abstract_; - this.abstract_ = abstract_; - this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_); - } - - private boolean buildAbstract() { - try { - return Flags.isAbstract(this.getMember().getFlags()); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - // ***** static - public boolean isStatic() { - return this.static_; - } - - private void setStatic(boolean static_) { - boolean old = this.static_; - this.static_ = static_; - this.firePropertyChanged(STATIC_PROPERTY, old, static_); - } - - private boolean buildStatic() { - try { - return Flags.isStatic(this.getMember().getFlags()); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - // ***** member - public boolean isMemberType() { - return this.memberType; - } - - private void setMemberType(boolean memberType) { - boolean old = this.memberType; - this.memberType = memberType; - this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType); - } - - private boolean buildMemberType() { - try { - return this.getMember().isMember(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - // ***** no-arg constructor - public boolean hasNoArgConstructor() { - return this.hasNoArgConstructor; - } - - private void setHasNoArgConstructor(boolean hasNoArgConstructor) { - boolean old = this.hasNoArgConstructor; - this.hasNoArgConstructor = hasNoArgConstructor; - this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor); - } - - private boolean buildHasNoArgConstructor() { - return this.findNoArgConstructor() != null; - } - - private IMethod findNoArgConstructor() { - try { - for (IMethod method : this.getMember().getMethods()) { - if (method.isConstructor()) { - return method; - } - } - } - catch (JavaModelException ex) { - JptCorePlugin.log(ex); - } - return null; - } - - // ***** private no-arg constructor - public boolean hasPrivateNoArgConstructor() { - return this.hasPrivateNoArgConstructor; - } - - private void setHasPrivateNoArgConstructor(boolean hasPrivateNoArgConstructor) { - boolean old = this.hasPrivateNoArgConstructor; - this.hasPrivateNoArgConstructor = hasPrivateNoArgConstructor; - this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, hasPrivateNoArgConstructor); - } - - private boolean buildHasPrivateNoArgConstructor() { - IMethod method = this.findNoArgConstructor(); - try { - return method != null && Flags.isPrivate(method.getFlags()); - } - catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - - // ********** misc ********** - - public boolean isMapped() { - for (Annotation each : CollectionTools.iterable(annotations())) { - if (CollectionTools.contains( - getAnnotationProvider().typeMappingAnnotationNames(), - each.getAnnotationName())) { - return true; - } - } - return false; - } - - /** - * check only persistable attributes - */ - public boolean hasAnyAnnotatedAttributes() { - for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) { - if (stream.next().isAnnotated()) { - return true; - } - } - return false; - } - - @Override - public IType getMember() { - return (IType) super.getMember(); - } - - - // ********** fields ********** - - public Iterator<JavaResourcePersistentAttribute> fields() { - return this.getFields().iterator(); - } - - private Iterable<JavaResourcePersistentAttribute> getFields() { - return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields); - } - - public Iterator<JavaResourcePersistentAttribute> persistableFields() { - return this.persistableMembers(this.fields()); - } - - public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute>( - this.persistableFields(), - FIELD_ACCESS_TYPE_FILTER - ); - } - - private void addField(JavaResourcePersistentAttribute field) { - this.addItemToCollection(field, this.fields, FIELDS_COLLECTION); - } - - private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) { - for (JavaResourcePersistentAttribute field : this.getFields()) { - if (field.isFor(fieldName, occurrence)) { - return field; - } - } - return null; - } - - private void removeFields(Collection<JavaResourcePersistentAttribute> remove) { - this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION); - } - - private Vector<JavaResourcePersistentAttribute> buildFields() { - IField[] jdtFields = this.getFields(this.getMember()); - Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtFields.length); - for (IField jdtField : jdtFields) { - result.add(this.buildField(jdtField)); - } - return result; - } - - private IField[] getFields(IType type) { - try { - return type.getFields(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_FIELD_ARRAY; - } - } - private static final IField[] EMPTY_FIELD_ARRAY = new IField[0]; - - private JavaResourcePersistentAttribute buildField(IField jdtField) { - return new BinaryPersistentAttribute(this, jdtField); - } - - - // ********** methods ********** - - public Iterator<JavaResourcePersistentAttribute> methods() { - return this.getMethods().iterator(); - } - - private Iterable<JavaResourcePersistentAttribute> getMethods() { - return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods); - } - - public Iterator<JavaResourcePersistentAttribute> persistableProperties() { - return persistableMembers(this.methods()); - } - - public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute>( - this.persistableProperties(), - PROPERTY_ACCESS_TYPE_FILTER - ); - } - - private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) { - for (JavaResourcePersistentAttribute method : this.getMethods()) { - if (method.isFor(signature, occurrence)) { - return method; - } - } - return null; - } - - private void addMethod(JavaResourcePersistentAttribute method) { - this.addItemToCollection(method, this.methods, METHODS_COLLECTION); - } - - private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) { - this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION); - } - - private Vector<JavaResourcePersistentAttribute> buildMethods() { - IMethod[] jdtMethods = this.getMethods(this.getMember()); - Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtMethods.length); - for (IMethod jdtMethod : jdtMethods) { - result.add(this.buildMethod(jdtMethod)); - } - return result; - } - - private IMethod[] getMethods(IType type) { - try { - return type.getMethods(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return EMPTY_METHOD_ARRAY; - } - } - private static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0]; - - private JavaResourcePersistentAttribute buildMethod(IMethod jdtMethod) { - return new BinaryPersistentAttribute(this, jdtMethod); - } - - - // ********** attributes ********** - - @SuppressWarnings("unchecked") - public Iterator<JavaResourcePersistentAttribute> persistableAttributes() { - return new CompositeIterator<JavaResourcePersistentAttribute>( - this.persistableFields(), - this.persistableProperties() - ); - } - - public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) { - switch (specifiedAccess) { - case FIELD : - return this.persistableAttributesForFieldAccessType(); - case PROPERTY : - return this.persistableAttributesForPropertyAccessType(); - default : - throw new IllegalArgumentException("unknown access: " + specifiedAccess); //$NON-NLS-1$ - } - } - - @SuppressWarnings("unchecked") - private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() { - return new CompositeIterator<JavaResourcePersistentAttribute>( - this.persistableFields(), - this.persistablePropertiesWithSpecifiedPropertyAccess() - ); - } - - @SuppressWarnings("unchecked") - private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() { - return new CompositeIterator<JavaResourcePersistentAttribute>( - this.persistableProperties(), - this.persistableFieldsWithSpecifiedFieldAccess() - ); - } - - - // ********** IType adapter ********** - - static class TypeAdapter implements Adapter { - private final IType type; - - TypeAdapter(IType type) { - super(); - this.type = type; - } - - public IType getElement() { - return this.type; - } - - public boolean isPersistable() { - return true; // we only build a JAR type if it is "persistable" - } - - public IAnnotation[] getAnnotations() throws JavaModelException { - return this.type.getAnnotations(); - } - - } - - - // ********** "persistable" check ********** - - static boolean typeIsPersistable(IType type) { - return (type != null) - && type.exists() - && JPTTools.typeIsPersistable(new JPTToolsAdapter(type)); - } - - - // ********** JPT tools adapter ********** - - /** - * JPTTools needs an adapter so it can work with either an IType - * or an ITypeBinding etc. - */ - static class JPTToolsAdapter implements JPTTools.TypeAdapter { - private final IType type; - - protected JPTToolsAdapter(IType type) { - super(); - if (type == null) { - throw new NullPointerException(); - } - this.type = type; - } - - public int getModifiers() { - try { - return this.type.getFlags(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return 0; - } - } - - public boolean isAnnotation() { - try { - return this.type.isAnnotation(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isAnonymous() { - try { - return this.type.isAnonymous(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isArray() { - return false; // ??? - } - - public boolean isEnum() { - try { - return this.type.isEnum(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isInterface() { - try { - return this.type.isInterface(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isLocal() { - try { - return this.type.isLocal(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isMember() { - try { - return this.type.isMember(); - } catch (JavaModelException ex) { - JptCorePlugin.log(ex); - return false; - } - } - - public boolean isPrimitive() { - return false; // ??? - } - - } - - - // ********** unsupported JavaResourcePersistentType implementation ********** - - public Iterator<JavaResourcePersistentType> types() { - throw new UnsupportedOperationException(); - } - - public Iterator<JavaResourcePersistentType> allTypes() { - throw new UnsupportedOperationException(); - } - - public Iterator<JavaResourcePersistentType> persistableTypes() { - throw new UnsupportedOperationException(); - } - - public boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder) { - throw new UnsupportedOperationException(); - } - - public boolean isGeneratedMetamodelTopLevelType() { - throw new UnsupportedOperationException(); - } - - public boolean isMetamodel() { - throw new UnsupportedOperationException(); - } - - public GeneratedAnnotation getGeneratedAnnotation() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java deleted file mode 100644 index bc1b8a1225..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.JpaAnnotationProvider; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentTypeCache; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * cache used to hold binary "external" Java resource persistent types - * (typically derived from JARs on the project's build path) - */ -public final class BinaryPersistentTypeCache - extends RootBinaryNode - implements JavaResourcePersistentTypeCache -{ - /** populated on-demand */ - private final Vector<Entry> entries = new Vector<Entry>(); - - - // ********** construction ********** - - public BinaryPersistentTypeCache(JpaAnnotationProvider annotationProvider) { - super(null, annotationProvider); - } - - - // ********** JavaResourceNode.Root implementation ********** - - public Iterator<JavaResourcePersistentType> persistentTypes() { - return this.getPersistentTypes().iterator(); - } - - private Iterable<JavaResourcePersistentType> getPersistentTypes() { - return new TransformationIterable<Entry, JavaResourcePersistentType>(this.getEntries()) { - @Override - protected JavaResourcePersistentType transform(Entry entry) { - return entry.persistentType; - } - }; - } - - private Iterable<Entry> getEntries() { - return new LiveCloneIterable<Entry>(this.entries); - } - - - // ********** JavaResourcePersistentTypeCache implementation ********** - - public int persistentTypesSize() { - return this.entries.size(); - } - - public JavaResourcePersistentType addPersistentType(IType jdtType) { - Entry entry = this.buildEntry(jdtType); - this.entries.add(entry); - this.fireItemAdded(PERSISTENT_TYPES_COLLECTION, entry.persistentType); - return entry.persistentType; - } - - private Entry buildEntry(IType jdtType) { - return new Entry(this.buildPersistentType(jdtType), jdtType.getResource()); - } - - private JavaResourcePersistentType buildPersistentType(IType jdtType) { - return new BinaryPersistentType(this, jdtType); - } - - public boolean removePersistentTypes(IFile jarFile) { - boolean modified = false; - for (Entry entry : this.getEntries()) { - IResource resource = entry.resource; - if ((resource != null) && resource.equals(jarFile)) { - this.removeEntry(entry); - modified = true; - } - } - return modified; - } - - private void removeEntry(Entry entry) { - this.entries.remove(entry); - this.fireItemRemoved(PERSISTENT_TYPES_COLLECTION, entry.persistentType); - } - - - // ********** overrides ********** - - /** - * Ignore changes to this collection. Adds can be ignored since they are triggered - * by requests that will, themselves, trigger updates (typically during the - * update of an object that calls a setter with the newly-created resource - * type). Deletes will be accompanied by manual updates. - */ - @Override - protected void aspectChanged(String aspectName) { - if ((aspectName != null) && ! aspectName.equals(PERSISTENT_TYPES_COLLECTION)) { - super.aspectChanged(aspectName); - } - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.entries); - } - - - // ********** cache entry ********** - - /** - * Associate a persistent type with its resource. - * This will be a JAR in the case of a type loaded from a JAR that is in - * the Eclipse workspace. The resource will be null for a type loaded - * from a JAR or class directory outside of the workspace. - */ - static class Entry { - final JavaResourcePersistentType persistentType; - final IResource resource; - - Entry(JavaResourcePersistentType persistentType, IResource resource) { - super(); - this.persistentType = persistentType; - this.resource = resource; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.persistentType); - } - - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java deleted file mode 100644 index 56bd7ae0b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation; - -/** - * javax.persistence.PrimaryKeyJoinColumn - */ -public final class BinaryPrimaryKeyJoinColumnAnnotation - extends BinaryNamedColumnAnnotation - implements NestablePrimaryKeyJoinColumnAnnotation -{ - private String referencedColumnName; - - - public BinaryPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.referencedColumnName = this.buildReferencedColumnName(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setReferencedColumnName_(this.buildReferencedColumnName()); - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** PrimaryKeyJoinColumnAnnotation implementation ********** - - // ***** referenced column name - public String getReferencedColumnName() { - return this.referencedColumnName; - } - - public void setReferencedColumnName(String referencedColumnName) { - throw new UnsupportedOperationException(); - } - - private void setReferencedColumnName_(String referencedColumnName) { - String old = this.referencedColumnName; - this.referencedColumnName = referencedColumnName; - this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName); - } - - private String buildReferencedColumnName() { - return (String) this.getJdtMemberValue(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME); - } - - public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java deleted file mode 100644 index 53fb9f0d46..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.PrimaryKeyJoinColumns - */ -public final class BinaryPrimaryKeyJoinColumnsAnnotation - extends BinaryContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation> - implements PrimaryKeyJoinColumnsAnnotation -{ - private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns; - - - public BinaryPrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.pkJoinColumns = this.buildPkJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns); - } - - public int getNestedAnnotationsSize() { - return this.pkJoinColumns.size(); - } - - private Vector<NestablePrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE); - Vector<NestablePrimaryKeyJoinColumnAnnotation> result = new Vector<NestablePrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updatePkJoinColumns(); - } - - // TODO - private void updatePkJoinColumns() { - throw new UnsupportedOperationException(); - } - -} - diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java deleted file mode 100644 index 86d34f1852..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.QueryAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.NamedQuery - * javax.persistence.NamedNativeQuery - */ -abstract class BinaryQueryAnnotation - extends BinaryAnnotation - implements QueryAnnotation -{ - String name; - String query; - final Vector<QueryHintAnnotation> hints; - - - BinaryQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.query = this.buildQuery(); - this.hints = this.buildHints(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setQuery_(this.buildQuery()); - this.updateHints(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** BaseNamedQueryAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - abstract String getNameElementName(); - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** query - public String getQuery() { - return this.query; - } - - public void setQuery(String query) { - throw new UnsupportedOperationException(); - } - - private void setQuery_(String query) { - String old = this.query; - this.query = query; - this.firePropertyChanged(QUERY_PROPERTY, old, query); - } - - private String buildQuery() { - return (String) this.getJdtMemberValue(this.getQueryElementName()); - } - - abstract String getQueryElementName(); - - public TextRange getQueryTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** hints - public ListIterator<QueryHintAnnotation> hints() { - return new CloneListIterator<QueryHintAnnotation>(this.hints); - } - - public int hintsSize() { - return this.hints.size(); - } - - public QueryHintAnnotation hintAt(int index) { - return this.hints.get(index); - } - - public int indexOfHint(QueryHintAnnotation queryHint) { - return this.hints.indexOf(queryHint); - } - - public QueryHintAnnotation addHint(int index) { - throw new UnsupportedOperationException(); - } - - public void moveHint(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeHint(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<QueryHintAnnotation> buildHints() { - Object[] jdtHints = this.getJdtMemberValues(this.getHintsElementName()); - Vector<QueryHintAnnotation> result = new Vector<QueryHintAnnotation>(jdtHints.length); - for (Object jdtHint : jdtHints) { - result.add(new BinaryQueryHintAnnotation(this, (IAnnotation) jdtHint)); - } - return result; - } - - abstract String getHintsElementName(); - - // TODO - private void updateHints() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java deleted file mode 100644 index b81056dfaf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; - -/** - * javax.persistence.QueryHint - */ -class BinaryQueryHintAnnotation - extends BinaryAnnotation - implements QueryHintAnnotation -{ - private String name; - private String value; - - - BinaryQueryHintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** QueryHintAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JPA.QUERY_HINT__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA.QUERY_HINT__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java deleted file mode 100644 index 1d1f4659a0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.jpa2.resource.java.RelationshipMapping2_0Annotation; -import org.eclipse.jpt.core.resource.java.CascadeType; -import org.eclipse.jpt.core.resource.java.FetchType; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.utility.internal.ArrayTools; - -/** - * javax.persistence.ManyToMany - * javax.persistence.ManyToOne - * javax.persistence.OneToMany - * javax.persistence.OneToOne - */ -abstract class BinaryRelationshipMappingAnnotation - extends BinaryAnnotation - implements RelationshipMapping2_0Annotation -{ - String targetEntity; - FetchType fetch; - boolean cascadeAll; - boolean cascadeMerge; - boolean cascadePersist; - boolean cascadeRefresh; - boolean cascadeRemove; - boolean cascadeDetach; //added in JPA 2.0 - - - BinaryRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.targetEntity = this.buildTargetEntity(); - this.fetch = this.buildFetch(); - this.initializeCascadeTypes(this.buildCascadeTypes()); - } - - protected void initializeCascadeTypes(CascadeType[] cascadeTypes) { - this.cascadeAll = ArrayTools.contains(cascadeTypes, CascadeType.ALL); - this.cascadeMerge = ArrayTools.contains(cascadeTypes, CascadeType.MERGE); - this.cascadePersist = ArrayTools.contains(cascadeTypes, CascadeType.PERSIST); - this.cascadeRefresh = ArrayTools.contains(cascadeTypes, CascadeType.REFRESH); - this.cascadeRemove = ArrayTools.contains(cascadeTypes, CascadeType.REMOVE); - this.cascadeDetach = ArrayTools.contains(cascadeTypes, CascadeType.DETACH); - } - - @Override - public void update() { - super.update(); - this.setTargetEntity_(this.buildTargetEntity()); - this.setFetch_(this.buildFetch()); - this.updateCascadeTypes(this.buildCascadeTypes()); - } - - protected void updateCascadeTypes(CascadeType[] cascadeTypes) { - this.setCascadeAll_(ArrayTools.contains(cascadeTypes, CascadeType.ALL)); - this.setCascadeMerge_(ArrayTools.contains(cascadeTypes, CascadeType.MERGE)); - this.setCascadePersist_(ArrayTools.contains(cascadeTypes, CascadeType.PERSIST)); - this.setCascadeRefresh_(ArrayTools.contains(cascadeTypes, CascadeType.REFRESH)); - this.setCascadeRemove_(ArrayTools.contains(cascadeTypes, CascadeType.REMOVE)); - this.setCascadeDetach_(ArrayTools.contains(cascadeTypes, CascadeType.DETACH)); - } - - // ********** RelationshipMappingAnnotation implementation ********** - - // ***** target entity - public String getTargetEntity() { - return this.targetEntity; - } - - public void setTargetEntity(String targetEntity) { - throw new UnsupportedOperationException(); - } - - private void setTargetEntity_(String targetEntity) { - String old = this.targetEntity; - this.targetEntity = targetEntity; - this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, targetEntity); - } - - private String buildTargetEntity() { - return (String) this.getJdtMemberValue(this.getTargetEntityElementName()); - } - - abstract String getTargetEntityElementName(); - - public TextRange getTargetEntityTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified target entity class name - public String getFullyQualifiedTargetEntityClassName() { - return this.targetEntity; - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - throw new UnsupportedOperationException(); - } - - private void setFetch_(FetchType fetch) { - FetchType old = this.fetch; - this.fetch = fetch; - this.firePropertyChanged(FETCH_PROPERTY, old, fetch); - } - - private FetchType buildFetch() { - return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getFetchElementName())); - } - - abstract String getFetchElementName(); - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** cascade - private CascadeType[] buildCascadeTypes() { - return CascadeType.fromJavaAnnotationValues(this.getJdtMemberValues(this.getCascadeElementName())); - } - - abstract String getCascadeElementName(); - - public TextRange getCascadeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** cascade all - public boolean isCascadeAll() { - return this.cascadeAll; - } - - public void setCascadeAll(boolean cascadeAll) { - throw new UnsupportedOperationException(); - } - - private void setCascadeAll_(boolean cascadeAll) { - boolean old = this.cascadeAll; - this.cascadeAll = cascadeAll; - this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, cascadeAll); - } - - // ***** cascade merge - public boolean isCascadeMerge() { - return this.cascadeMerge; - } - - public void setCascadeMerge(boolean cascadeMerge) { - throw new UnsupportedOperationException(); - } - - private void setCascadeMerge_(boolean cascadeMerge) { - boolean old = this.cascadeMerge; - this.cascadeMerge = cascadeMerge; - this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, cascadeMerge); - } - - // ***** cascade persist - public boolean isCascadePersist() { - return this.cascadePersist; - } - - public void setCascadePersist(boolean cascadePersist) { - throw new UnsupportedOperationException(); - } - - private void setCascadePersist_(boolean cascadePersist) { - boolean old = this.cascadePersist; - this.cascadePersist = cascadePersist; - this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist); - } - - // ***** cascade refresh - public boolean isCascadeRefresh() { - return this.cascadeRefresh; - } - - public void setCascadeRefresh(boolean cascadeRefresh) { - throw new UnsupportedOperationException(); - } - - private void setCascadeRefresh_(boolean cascadeRefresh) { - boolean old = this.cascadeRefresh; - this.cascadeRefresh = cascadeRefresh; - this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, cascadeRefresh); - } - - // ***** cascade remove - public boolean isCascadeRemove() { - return this.cascadeRemove; - } - - public void setCascadeRemove(boolean cascadeRemove) { - throw new UnsupportedOperationException(); - } - - private void setCascadeRemove_(boolean cascadeRemove) { - boolean old = this.cascadeRemove; - this.cascadeRemove = cascadeRemove; - this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, cascadeRemove); - } - - // ***** cascade detach - JPA 2.0 - public boolean isCascadeDetach() { - return this.cascadeDetach; - } - - public void setCascadeDetach(boolean cascadeDetach) { - throw new UnsupportedOperationException(); - } - - private void setCascadeDetach_(boolean cascadeDetach) { - boolean old = this.cascadeDetach; - this.cascadeDetach = cascadeDetach; - this.firePropertyChanged(CASCADE_DETACH_PROPERTY, old, cascadeDetach); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java deleted file mode 100644 index 7e018e6cb9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation; -import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.SecondaryTable - */ -public final class BinarySecondaryTableAnnotation - extends BinaryBaseTableAnnotation - implements NestableSecondaryTableAnnotation -{ - private final Vector<PrimaryKeyJoinColumnAnnotation> pkJoinColumns; - - public BinarySecondaryTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.pkJoinColumns = this.buildPkJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updatePkJoinColumns(); - } - - - // ********** BinaryBaseTableAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.SECONDARY_TABLE__NAME; - } - - @Override - protected String getSchemaElementName() { - return JPA.SECONDARY_TABLE__SCHEMA; - } - - @Override - protected String getCatalogElementName() { - return JPA.SECONDARY_TABLE__CATALOG; - } - - @Override - protected String getUniqueConstraintElementName() { - return JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS; - } - - - // ************* SecondaryTableAnnotation implementation ******************* - - // ***** pk join columns - public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() { - return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns); - } - - public int pkJoinColumnsSize() { - return this.pkJoinColumns.size(); - } - - public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) { - return this.pkJoinColumns.get(index); - } - - public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn) { - return this.pkJoinColumns.indexOf(pkJoinColumn); - } - - public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void movePkJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removePkJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<PrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS); - Vector<PrimaryKeyJoinColumnAnnotation> result = new Vector<PrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updatePkJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java deleted file mode 100644 index 5dbc1fd97f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation; -import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation; -import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; - -/** - * javax.persistence.SecondaryTables - */ -public final class BinarySecondaryTablesAnnotation - extends BinaryContainerAnnotation<NestableSecondaryTableAnnotation> - implements SecondaryTablesAnnotation -{ - private final Vector<NestableSecondaryTableAnnotation> secondaryTables; - - - public BinarySecondaryTablesAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.secondaryTables = this.buildSecondaryTables(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableSecondaryTableAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableSecondaryTableAnnotation>(this.secondaryTables); - } - - public int getNestedAnnotationsSize() { - return this.secondaryTables.size(); - } - - private Vector<NestableSecondaryTableAnnotation> buildSecondaryTables() { - Object[] jdtSecondaryTables = this.getJdtMemberValues(JPA.SECONDARY_TABLES__VALUE); - Vector<NestableSecondaryTableAnnotation> result = new Vector<NestableSecondaryTableAnnotation>(jdtSecondaryTables.length); - for (Object jdtSecondaryTable : jdtSecondaryTables) { - result.add(new BinarySecondaryTableAnnotation(this, (IAnnotation) jdtSecondaryTable)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateSecondaryTables(); - } - - // TODO - private void updateSecondaryTables() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java deleted file mode 100644 index 8bc1628575..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; - -/** - * javax.persistence.SequenceGenerator - */ -public abstract class BinarySequenceGeneratorAnnotation - extends BinaryGeneratorAnnotation - implements SequenceGeneratorAnnotation -{ - private String sequenceName; - - - protected BinarySequenceGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.sequenceName = this.buildSequenceName(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setSequenceName_(this.buildSequenceName()); - } - - - // ********** BinaryGeneratorAnnotation implementation ********** - - @Override - String getNameElementName() { - return JPA.SEQUENCE_GENERATOR__NAME; - } - - @Override - String getInitialValueElementName() { - return JPA.SEQUENCE_GENERATOR__INITIAL_VALUE; - } - - @Override - String getAllocationSizeElementName() { - return JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE; - } - - - // ********** SequenceGeneratorAnnotation implementation ********** - - // ***** sequence name - public String getSequenceName() { - return this.sequenceName; - } - - public void setSequenceName(String sequenceName) { - throw new UnsupportedOperationException(); - } - - private void setSequenceName_(String sequenceName) { - String old = this.sequenceName; - this.sequenceName = sequenceName; - this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, sequenceName); - } - - private String buildSequenceName() { - return (String) this.getJdtMemberValue(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME); - } - - public TextRange getSequenceNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java deleted file mode 100644 index e7bcdc7306..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.resource.java.TableAnnotation; - -/** - * javax.persistence.Table - */ -public final class BinaryTableAnnotation - extends BinaryBaseTableAnnotation - implements TableAnnotation -{ - public BinaryTableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryBaseTableAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA.TABLE__NAME; - } - - @Override - protected String getSchemaElementName() { - return JPA.TABLE__SCHEMA; - } - - @Override - protected String getCatalogElementName() { - return JPA.TABLE__CATALOG; - } - - @Override - protected String getUniqueConstraintElementName() { - return JPA.TABLE__UNIQUE_CONSTRAINTS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java deleted file mode 100644 index 6798e70061..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.TableGenerator - */ -public final class BinaryTableGeneratorAnnotation - extends BinaryGeneratorAnnotation - implements TableGeneratorAnnotation -{ - private String table; - private String schema; - private String catalog; - private String pkColumnName; - private String valueColumnName; - private String pkColumnValue; - private final Vector<UniqueConstraintAnnotation> uniqueConstraints; - - - public BinaryTableGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.table = this.buildTable(); - this.schema = this.buildSchema(); - this.catalog = this.buildCatalog(); - this.pkColumnName = this.buildPkColumnName(); - this.valueColumnName = this.buildValueColumnName(); - this.pkColumnValue = this.buildPkColumnValue(); - this.uniqueConstraints = this.buildUniqueConstraints(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setTable_(this.buildTable()); - this.setSchema_(this.buildSchema()); - this.setCatalog_(this.buildCatalog()); - this.setPkColumnName_(this.buildPkColumnName()); - this.setValueColumnName_(this.buildValueColumnName()); - this.setPkColumnValue_(this.buildPkColumnValue()); - this.updateUniqueConstraints(); - } - - - // ********** AbstractGeneratorAnnotation implementation ********** - - @Override - String getNameElementName() { - return JPA.TABLE_GENERATOR__NAME; - } - - @Override - String getInitialValueElementName() { - return JPA.TABLE_GENERATOR__INITIAL_VALUE; - } - - @Override - String getAllocationSizeElementName() { - return JPA.TABLE_GENERATOR__ALLOCATION_SIZE; - } - - - // ********** TableGeneratorAnnotation implementation ********** - - // ***** table - public String getTable() { - return this.table; - } - - public void setTable(String table) { - throw new UnsupportedOperationException(); - } - - private void setTable_(String table) { - String old = this.table; - this.table = table; - this.firePropertyChanged(TABLE_PROPERTY, old, table); - } - - private String buildTable() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__TABLE); - } - - public TextRange getTableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean tableTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** schema - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - throw new UnsupportedOperationException(); - } - - private void setSchema_(String schema) { - String old = this.schema; - this.schema = schema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, schema); - } - - private String buildSchema() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__SCHEMA); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** catalog - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - throw new UnsupportedOperationException(); - } - - private void setCatalog_(String catalog) { - String old = this.catalog; - this.catalog = catalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, catalog); - } - - private String buildCatalog() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__CATALOG); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** pk column name - public String getPkColumnName() { - return this.pkColumnName; - } - - public void setPkColumnName(String pkColumnName) { - throw new UnsupportedOperationException(); - } - - private void setPkColumnName_(String pkColumnName) { - String old = this.pkColumnName; - this.pkColumnName = pkColumnName; - this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, pkColumnName); - } - - private String buildPkColumnName() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_NAME); - } - - public TextRange getPkColumnNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** value column name - public String getValueColumnName() { - return this.valueColumnName; - } - - public void setValueColumnName(String valueColumnName) { - throw new UnsupportedOperationException(); - } - - private void setValueColumnName_(String valueColumnName) { - String old = this.valueColumnName; - this.valueColumnName = valueColumnName; - this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, valueColumnName); - } - - private String buildValueColumnName() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME); - } - - public TextRange getValueColumnNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** pk column value - public String getPkColumnValue() { - return this.pkColumnValue; - } - - public void setPkColumnValue(String pkColumnValue) { - throw new UnsupportedOperationException(); - } - - private void setPkColumnValue_(String pkColumnValue) { - String old = this.pkColumnValue; - this.pkColumnValue = pkColumnValue; - this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, pkColumnValue); - } - - private String buildPkColumnValue() { - return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE); - } - - public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** unique constraints - public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() { - return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public UniqueConstraintAnnotation uniqueConstraintAt(int index) { - return this.uniqueConstraints.get(index); - } - - public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) { - return this.uniqueConstraints.indexOf(uniqueConstraint); - } - - public UniqueConstraintAnnotation addUniqueConstraint(int index) { - throw new UnsupportedOperationException(); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeUniqueConstraint(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() { - Object[] jdtUniqueConstraints = this.getJdtMemberValues(JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS); - Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length); - for (Object jdtUniqueConstraint : jdtUniqueConstraints) { - result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint)); - } - return result; - } - - // TODO - private void updateUniqueConstraints() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java deleted file mode 100644 index b4e6fd81ee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.TemporalAnnotation; - -/** - * javax.persistence.Temporal - */ -public final class BinaryTemporalAnnotation - extends BinaryBaseTemporalAnnotation - implements TemporalAnnotation -{ - - public BinaryTemporalAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA.TEMPORAL__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java deleted file mode 100644 index 92e643fd4b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.TransientAnnotation; - -/** - * javax.persistence.Transient - */ -public final class BinaryTransientAnnotation - extends BinaryAnnotation - implements TransientAnnotation -{ - - public BinaryTransientAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java deleted file mode 100644 index 2d8af3aec7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * javax.persistence.UniqueConstraint - */ -final class BinaryUniqueConstraintAnnotation - extends BinaryAnnotation - implements UniqueConstraintAnnotation -{ - private final Vector<String> columnNames; - - - BinaryUniqueConstraintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.columnNames = this.buildColumnNames(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateColumnNames(); - } - - // TODO - private void updateColumnNames() { - throw new UnsupportedOperationException(); - } - - - // ********** UniqueConstraintAnnotation implementation ********** - - // ***** column names - public ListIterator<String> columnNames() { - return new CloneListIterator<String>(this.columnNames); - } - - public int columnNamesSize() { - return this.columnNames.size(); - } - - private Vector<String> buildColumnNames() { - Object[] jdtColumnNames = this.getJdtMemberValues(JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES); - Vector<String> result = new Vector<String>(jdtColumnNames.length); - for (Object jdtColumnName : jdtColumnNames) { - result.add((String) jdtColumnName); - } - return result; - } - - public void addColumnName(String columnName) { - throw new UnsupportedOperationException(); - } - - public void addColumnName(int index, String columnName) { - throw new UnsupportedOperationException(); - } - - public void moveColumnName(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public boolean columnNamesTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void removeColumnName(String columnName) { - throw new UnsupportedOperationException(); - } - - public void removeColumnName(int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java deleted file mode 100644 index 37f3256a19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.VersionAnnotation; - -/** - * javax.persistence.Version - */ -public final class BinaryVersionAnnotation - extends BinaryAnnotation - implements VersionAnnotation -{ - - public BinaryVersionAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java deleted file mode 100644 index 0c5cf221d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.resource.java.binary; - -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.core.JpaAnnotationProvider; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.utility.internal.ListenerList; - -/** - * JAR and external types - */ -abstract class RootBinaryNode - extends BinaryNode - implements JavaResourceNode.Root -{ - /** pluggable annotation provider */ - private final JpaAnnotationProvider annotationProvider; - - /** listeners notified whenever the resource model changes */ - private final ListenerList<JptResourceModelListener> resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class); - - - // ********** construction ********** - - RootBinaryNode(JavaResourceNode parent, JpaAnnotationProvider annotationProvider) { - super(parent); - this.annotationProvider = annotationProvider; - } - - - // ********** overrides ********** - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public Root getRoot() { - return this; - } - - @Override - public JpaAnnotationProvider getAnnotationProvider() { - return this.annotationProvider; - } - - - // ********** JavaResourceNode.Root implementation ********** - - public void resourceModelChanged() { - for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) { - listener.resourceModelChanged(this); - } - } - - - // ********** JptResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - - public void addResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.add(listener); - } - - public void removeResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.remove(listener); - } - -} |