Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2009-12-02 18:34:56 -0500
committerbvosburgh2009-12-02 18:34:56 -0500
commita856ef6a14ec81e8fe260e3b585f1deb4fb42b36 (patch)
tree75636e4523639ca640a8ef282f8dc9df12936063
parent43aa60b5d0f5511953e750a5984fae3b30016bbe (diff)
downloadwebtools.dali-a856ef6a14ec81e8fe260e3b585f1deb4fb42b36.tar.gz
webtools.dali-a856ef6a14ec81e8fe260e3b585f1deb4fb42b36.tar.xz
webtools.dali-a856ef6a14ec81e8fe260e3b585f1deb4fb42b36.zip
refactor JavaResourcePersistentType for 2.0
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JavaResourcePersistentType2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java30
8 files changed, 75 insertions, 47 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
index be49e33b31..6000410166 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
@@ -53,6 +53,7 @@ import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
@@ -917,20 +918,20 @@ public abstract class AbstractJpaProject
// ********** metamodel **********
- public Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes() {
+ public Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTypes() {
if (this.metamodelSourceFolderName == null) {
return EmptyIterable.instance();
}
final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
+ return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes()) {
@Override
protected boolean accept(JavaResourcePersistentType jrpt) {
- return jrpt.isGeneratedMetamodel(genSourceFolder);
+ return ((JavaResourcePersistentType2_0) jrpt).isGeneratedMetamodel(genSourceFolder);
}
};
}
- public JavaResourcePersistentType getGeneratedMetamodelType(IFile file) {
+ public JavaResourcePersistentType2_0 getGeneratedMetamodelType(IFile file) {
JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file);
if (jrcu == null) {
return null; // hmmm...
@@ -939,7 +940,7 @@ public abstract class AbstractJpaProject
if ( ! types.hasNext()) {
return null; // no types in the file
}
- JavaResourcePersistentType jrpt = types.next();
+ JavaResourcePersistentType2_0 jrpt = (JavaResourcePersistentType2_0) types.next();
if (types.hasNext()) {
return null; // should have only a single type in the file
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
index a158cfe75d..95ad6b192b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -47,7 +47,7 @@ import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
@@ -1649,15 +1649,15 @@ public abstract class AbstractPersistenceUnit
}
protected Iterable<IFile> getGeneratedMetamodelFiles() {
- return new TransformationIterable<JavaResourcePersistentType, IFile>(this.getGeneratedMetamodelTypes()) {
+ return new TransformationIterable<JavaResourcePersistentType2_0, IFile>(this.getGeneratedMetamodelTypes()) {
@Override
- protected IFile transform(JavaResourcePersistentType jrpt) {
+ protected IFile transform(JavaResourcePersistentType2_0 jrpt) {
return jrpt.getFile();
}
};
}
- protected Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes() {
+ protected Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTypes() {
return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTypes();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
index e7de5dbca6..1002ef5192 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
@@ -34,7 +34,7 @@ import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
@@ -108,7 +108,7 @@ public class GenericPersistentTypeMetamodelSynchronizer
*/
protected String buildSource(ICompilationUnit compilationUnit) throws JavaModelException {
IFile file = (IFile) compilationUnit.getResource();
- JavaResourcePersistentType genType = this.getJpaProject().getGeneratedMetamodelType(file);
+ JavaResourcePersistentType2_0 genType = this.getJpaProject().getGeneratedMetamodelType(file);
if (genType == null) {
return null; // the file exists, but its source is not a generated metamodel class
}
@@ -240,7 +240,7 @@ public class GenericPersistentTypeMetamodelSynchronizer
pw.printAnnotation("javax.annotation.Generated");
pw.print('(');
pw.print("value=");
- pw.printStringLiteral(JavaResourcePersistentType.METAMODEL_GENERATED_ANNOTATION_VALUE);
+ pw.printStringLiteral(JavaResourcePersistentType2_0.METAMODEL_GENERATED_ANNOTATION_VALUE);
pw.print(", ");
pw.print("date=");
pw.printStringLiteral(format(new Date()));
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
index 8edbaf60f8..4a8778a721 100644
--- 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
@@ -12,6 +12,7 @@ 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;
@@ -22,6 +23,7 @@ import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
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;
@@ -38,7 +40,7 @@ import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
*/
final class BinaryPersistentType
extends BinaryPersistentMember
- implements JavaResourcePersistentType
+ implements JavaResourcePersistentType2_0
{
private String name;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
index 268c44ce44..ad8f496833 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
@@ -32,6 +32,7 @@ import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
import org.eclipse.jpt.core.internal.utility.jdt.JDTType;
import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
import org.eclipse.jpt.core.resource.java.AccessType;
import org.eclipse.jpt.core.resource.java.Annotation;
@@ -53,7 +54,7 @@ import org.eclipse.jpt.utility.internal.iterators.TreeIterator;
*/
final class SourcePersistentType
extends SourcePersistentMember<Type>
- implements JavaResourcePersistentType
+ implements JavaResourcePersistentType2_0
{
private String name;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
index 71f1b5e711..3295837586 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.core.jpa2;
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
/**
* JPA 2.0 project.
@@ -64,7 +64,7 @@ public interface JpaProject2_0
* types.
* @see org.eclipse.jpt.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel(IPackageFragmentRoot)
*/
- Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes();
+ Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTypes();
/**
* Return the generated metamodel Java resource persistent type in the
@@ -77,7 +77,7 @@ public interface JpaProject2_0
* <code>javax.annotation.Generated</code> annotation
* <ul>
*/
- JavaResourcePersistentType getGeneratedMetamodelType(IFile file);
+ JavaResourcePersistentType2_0 getGeneratedMetamodelType(IFile file);
// ********** construction config **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JavaResourcePersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
new file mode 100644
index 0000000000..37785bad8a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * JPA 2.0 Java source code or binary persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaResourcePersistentType2_0
+ extends JavaResourcePersistentType
+{
+
+ // ********** metamodel **********
+
+ /**
+ * Return the <code>javax.annotation.Generated</code> annotation.
+ */
+ GeneratedAnnotation getGeneratedAnnotation();
+
+ /**
+ * Return whether the type is a metamodel type generated in the specified
+ * source folder.
+ */
+ boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder);
+
+ /**
+ * Return whether the type is a generated metamodel type.
+ */
+ boolean isGeneratedMetamodel();
+
+ /**
+ * The value used to tag a generated type:
+ * <pre>
+ * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
+ * </pre>
+ */
+ String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
index e0bb621c80..ca1459d724 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
@@ -11,9 +11,6 @@ package org.eclipse.jpt.core.resource.java;
import java.util.Iterator;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-
/**
* Java source code or binary persistent type.
* <p>
@@ -142,31 +139,4 @@ public interface JavaResourcePersistentType
*/
Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess);
-
- // ********** metamodel **********
-
- /**
- * Return the <code>javax.annotation.Generated</code> annotation.
- */
- GeneratedAnnotation getGeneratedAnnotation();
-
- /**
- * Return whether the type is a metamodel type generated in the specified
- * source folder.
- */
- boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder);
-
- /**
- * Return whether the type is a generated metamodel type.
- */
- boolean isGeneratedMetamodel();
-
- /**
- * The value used to tag a generated type:
- * <pre>
- * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
- * </pre>
- */
- String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
-
}

Back to the top