diff options
author | pfullbright | 2009-08-21 21:03:02 +0000 |
---|---|---|
committer | pfullbright | 2009-08-21 21:03:02 +0000 |
commit | bde928793a90c6824b2449e0402bc47f026ec89f (patch) | |
tree | d7a669410327ea178e854803588be3938a3f73b1 /jpa | |
parent | a84f3f1800af29e2cd54c9cf20f1c650bb59d1bd (diff) | |
download | webtools.dali-bde928793a90c6824b2449e0402bc47f026ec89f.tar.gz webtools.dali-bde928793a90c6824b2449e0402bc47f026ec89f.tar.xz webtools.dali-bde928793a90c6824b2449e0402bc47f026ec89f.zip |
Big hunk of derived id prework - small tweaks to follow
Diffstat (limited to 'jpa')
254 files changed, 4881 insertions, 4474 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationDefinitionProvider.java index 73fc9d6d80..91128f8036 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationDefinitionProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationDefinitionProvider.java @@ -9,7 +9,7 @@ ******************************************************************************/ package org.eclipse.jpt.core; -import java.util.ListIterator; +import java.util.Iterator; import org.eclipse.jpt.core.resource.java.AnnotationDefinition; /** @@ -22,34 +22,20 @@ import org.eclipse.jpt.core.resource.java.AnnotationDefinition; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * - * @version 2.2 + * @version 3.0 * @since 2.2 */ -public interface JpaAnnotationDefinitionProvider { - +public interface JpaAnnotationDefinitionProvider +{ /** - * Return a ListIterator of mapping annotation definitions which can + * Return a ListIterator of all annotation definitions which can * be placed on a type */ - ListIterator<AnnotationDefinition> typeMappingAnnotationDefinitions(); - - /** - * Return a ListIterator of supporting annotation definitions which can - * be placed on a type. These annotations are used in conjunction with the - * type mapping annotations - */ - ListIterator<AnnotationDefinition> typeSupportingAnnotationDefinitions(); + Iterator<AnnotationDefinition> typeAnnotationDefinitions(); /** - * Return a ListIterator of mapping annotation definitions which can + * Return a ListIterator of all annotation definitions which can * be placed on an attribute */ - ListIterator<AnnotationDefinition> attributeMappingAnnotationDefinitions(); - - /** - * Return a ListIterator of supporting annotation definitions which can - * be placed on a attribute. These annotations are used in conjunction with the - * attribute mapping annotations - */ - ListIterator<AnnotationDefinition> attributeSupportingAnnotationDefinitions(); + Iterator<AnnotationDefinition> attributeAnnotationDefinitions(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationProvider.java index e32ee5c676..649db41a87 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaAnnotationProvider.java @@ -9,8 +9,7 @@ ******************************************************************************/ package org.eclipse.jpt.core; -import java.util.ListIterator; - +import java.util.Iterator; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jpt.core.resource.java.Annotation; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; @@ -19,7 +18,7 @@ import org.eclipse.jpt.core.utility.jdt.Attribute; import org.eclipse.jpt.core.utility.jdt.Type; /** - * This is used to provide type and attribute mapping and supporting annotations. + * This is used to provide type and attribute annotations. * Also provides list of supported annotation names, check the appropriate list * before trying to build an annotation with that name. An exception will * be thrown on an attempt to build an annotation that does not exist. @@ -28,7 +27,7 @@ import org.eclipse.jpt.core.utility.jdt.Type; * JpaAnnotationDefinitionProvider to extend the list of supported annotation definitions. * * @see JpaAnnotationDefinitionProvider - * @version 2.2 + * @version 3.0 * @since 2.0? * * Provisional API: This interface is part of an interim API that is still @@ -37,110 +36,68 @@ import org.eclipse.jpt.core.utility.jdt.Type; * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. */ -public interface JpaAnnotationProvider { - +public interface JpaAnnotationProvider +{ // ********** type annotations ********** - + /** - * Return the names of the mapping annotations that can modify a type. + * Return the names of the annotations that can appear on a type. */ - ListIterator<String> typeMappingAnnotationNames(); - + Iterator<String> typeAnnotationNames(); + /** - * Build a type mapping annotation with the specified name. + * Build a type annotation with the specified name. * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #typeMappingAnnotationNames() + * @see #typeAnnotationNames() */ - Annotation buildTypeMappingAnnotation(JavaResourcePersistentType parent, Type type, String annotationName); - + Annotation buildTypeAnnotation( + JavaResourcePersistentType parent, Type type, String annotationName); + /** - * Build a type mapping annotation for the specified JDT annotation. + * Build a type annotation for the specified JDT annotation. * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #typeMappingAnnotationNames() + * @see #typeAnnotationNames() */ - Annotation buildTypeMappingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation); - + Annotation buildTypeAnnotation( + JavaResourcePersistentType parent, IAnnotation jdtAnnotation); + /** - * Return the names of the supporting annotations that can modify a type. - */ - ListIterator<String> typeSupportingAnnotationNames(); - - /** - * Build a type supporting annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #typeSupportingAnnotationNames() - */ - Annotation buildTypeSupportingAnnotation(JavaResourcePersistentType parent, Type type, String annotationName); - - /** - * Build a type supporting annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #typeSupportingAnnotationNames() - */ - Annotation buildTypeSupportingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation); - - /** - * Build a null type supporting annotation with the specified name. + * Build a null type annotation with the specified name. * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #typeSupportingAnnotationNames() + * @see #typeAnnotationNames() */ - Annotation buildNullTypeSupportingAnnotation(JavaResourcePersistentType parent, String annotationName); - - + Annotation buildNullTypeAnnotation( + JavaResourcePersistentType parent, String annotationName); + + // ********** attribute annotations ********** - + /** - * Return the names of the mapping annotations that can modify an attribute. + * Return the names of the annotations that can appear on an attribute. */ - ListIterator<String> attributeMappingAnnotationNames(); - + Iterator<String> attributeAnnotationNames(); + /** - * Build an attribute mapping annotation with the specified name. + * Build an attribute annotation with the specified name. * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #attributeMappingAnnotationNames() + * @see #attributeAnnotationNames() */ - Annotation buildAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName); - + Annotation buildAttributeAnnotation( + JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName); + /** - * Build an attribute mapping annotation for the specified JDT annotation. + * Build an attribute annotation for the specified JDT annotation. * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #attributeMappingAnnotationNames() + * @see #attributeAnnotationNames() */ - Annotation buildAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation); - + Annotation buildAttributeAnnotation( + JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation); + /** - * Build a null attribute mapping annotation with the specified name. + * Build a null attribute annotation with the specified name. * Throw an IllegalArgumentException if the specified annotation is unsupported. - * This is used by an attribute's "default" mapping, since there is no - * annotation present (thus the "default" part...). * @see #attributeMappingAnnotationNames() */ - Annotation buildNullAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, String annotationName); - - /** - * Return the names of the supporting annotations that can modify an attribute. - */ - ListIterator<String> attributeSupportingAnnotationNames(); - - /** - * Build an attribute supporting annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #attributeSupportingAnnotationNames() - */ - Annotation buildAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName); - - /** - * Build an attribute supporting annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #attributeSupportingAnnotationNames() - */ - Annotation buildAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation); - - /** - * Build a null attribute supporting annotation with the specified name. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #attributeSupportingAnnotationNames() - */ - Annotation buildNullAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, String annotationName); - + Annotation buildNullAttributeAnnotation( + JavaResourcePersistentAttribute parent, String annotationName); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaPlatform.java index 00894913a9..bdce4e05b4 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaPlatform.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaPlatform.java @@ -15,7 +15,10 @@ import org.eclipse.jpt.core.context.MappingFileDefinition; import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; +import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; +import org.eclipse.jpt.core.context.java.NullDefaultJavaAttributeMappingProvider; +import org.eclipse.jpt.core.context.java.NullJavaTypeMappingProvider; +import org.eclipse.jpt.core.context.java.NullSpecifiedJavaAttributeMappingProvider; import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter; import org.eclipse.jpt.db.ConnectionProfileFactory; import org.eclipse.jpt.db.DatabaseFinder; @@ -85,22 +88,21 @@ public interface JpaPlatform // ********** Java type/attribute mappings ********** /** - * Build a Java type mapping for the specified key and persistent type. - * Use identity when comparing keys; so clients must use the same key - * constants as the providers. - * Throw an IllegalArgumentException if the key is not supported by the - * platform. + * Return a {@link JavaTypeMappingProvider} that describes the interpretation of the type + * as it exists, complete with annotations. + * This may not be null (@see {@link NullJavaTypeMappingProvider},) else + * an {@link IllegalStateException} is thrown. + * + * @param type The persistent type to analyze + * @return The mapping provider describing the annotated state of the type */ - JavaTypeMapping buildJavaTypeMappingFromMappingKey(String key, JavaPersistentType type); + JavaTypeMappingProvider getJavaTypeMappingProvider(JavaPersistentType type); /** - * Build a Java type mapping for the specified annotation and persistent - * type. Use identity when comparing annotation names; so clients must - * use the same name constants as the providers. - * Throw an IllegalArgumentException if the mapping annotation is not - * supported by the platform. + * Return a {@link JavaTypeMappingProvider} for the given mapping key. + * Throw an {@link IllegalArgumentException} if the key is not supported by the platform. */ - JavaTypeMapping buildJavaTypeMappingFromAnnotation(String annotationName, JavaPersistentType type); + JavaTypeMappingProvider getJavaTypeMappingProvider(String mappingKey); /** * Return a {@link JavaAttributeMappingProvider} that describes the interpretation of the attribute @@ -117,7 +119,8 @@ public interface JpaPlatform * Return a {@link JavaAttributeMappingProvider} that describes the interpretation of the attribute * as it exists, complete with annotations. It is assumed that the attribute's default mapping * has already been determined. - * This may be null. + * This may not be null (@see {@link NullSpecifiedJavaAttributeMappingProvider},) else + * an {@link IllegalStateException} is thrown. * * @param attribute The persistent attribute to analyze * @return The mapping provider describing the annotated state of the attribute diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMappingProvider.java index 1c10bfdf78..803e0668d4 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMappingProvider.java @@ -44,11 +44,11 @@ public interface JavaAttributeMappingProvider * Return whether this mapping provider should be used for the given {@link JavaPersistentAttribute} * in the default (ignoring all mapping annotations) case. */ - boolean defaultApplies(JavaPersistentAttribute persistentAttribute); + boolean testDefault(JavaPersistentAttribute persistentAttribute); /** * Return whether this mapping provider should be used for the given {@link JavaPersistentAttribute} * in the specified (observing all mapping annotations) case. */ - boolean specifiedApplies(JavaPersistentAttribute persistentAttribute); + boolean testSpecified(JavaPersistentAttribute persistentAttribute); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaPersistentType.java index aa81bc8b4c..f8fef26be9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaPersistentType.java @@ -34,16 +34,15 @@ public interface JavaPersistentType ListIterator<JavaPersistentAttribute> attributes(); JavaPersistentAttribute getAttributeNamed(String attributeName); - - + + // ********** Java ********** - + /** - * Return whether the persistent type contains an attribute with - * a mapping annotation. + * Return whether any attribute in this persistent type is annotated */ - boolean hasAnyAttributePersistenceAnnotations(); - + boolean hasAnyAnnotatedAttributes(); + /** * Return the Java resource persistent type. */ diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java index 10ef63df07..3fb9ff396a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java @@ -34,7 +34,7 @@ public interface JavaTypeMapping extends TypeMapping, JavaJpaContextNode String getAnnotationName(); - Iterator<String> correspondingAnnotationNames(); + Iterator<String> supportingAnnotationNames(); JavaPersistentType getPersistentType(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMappingProvider.java index 6225b78cd0..63851cca70 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMappingProvider.java @@ -39,5 +39,10 @@ public interface JavaTypeMappingProvider { * creation method instead of building a provider for the same key. */ public JavaTypeMapping buildMapping(JavaPersistentType type, JpaFactory factory); - + + /** + * Return whether this mapping provider should be used for the given {@link JavaPersistentType}, + * considering all annotations. + */ + boolean test(JavaPersistentType persistentType); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullDefaultJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullDefaultJavaAttributeMappingProvider.java index fe1e627bda..ad25ee6de6 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullDefaultJavaAttributeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullDefaultJavaAttributeMappingProvider.java @@ -58,14 +58,14 @@ public class NullDefaultJavaAttributeMappingProvider /** * This is typically the final test, so it should always apply */ - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return true; } /** * Obviously, always false */ - public boolean specifiedApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testSpecified(JavaPersistentAttribute persistentAttribute) { return false; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullJavaTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullJavaTypeMappingProvider.java index aec6fb2cc7..1556bcfe90 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullJavaTypeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullJavaTypeMappingProvider.java @@ -21,7 +21,8 @@ public class NullJavaTypeMappingProvider implements JavaTypeMappingProvider { // singleton - private static final NullJavaTypeMappingProvider INSTANCE = new NullJavaTypeMappingProvider(); + private static final NullJavaTypeMappingProvider INSTANCE = + new NullJavaTypeMappingProvider(); /** @@ -52,6 +53,13 @@ public class NullJavaTypeMappingProvider return factory.buildJavaNullTypeMapping(parent); } + /** + * This is typically the final test, so it should always apply + */ + public boolean test(JavaPersistentType persistentType) { + return true; + } + @Override public String toString() { return StringTools.buildToStringFor(this, this.getAnnotationName()); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java index a36b941c17..4919758e44 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java @@ -58,14 +58,14 @@ public class NullSpecifiedJavaAttributeMappingProvider /** * Obviously false */ - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return false; } /** * This is typically the final test, so it should always apply */ - public boolean specifiedApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testSpecified(JavaPersistentAttribute persistentAttribute) { return true; } } 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 bde18ed5b8..68da85962e 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 @@ -707,7 +707,7 @@ public abstract class AbstractJpaProject return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) { @Override protected boolean accept(JavaResourcePersistentType jrpType) { - return jrpType.isPersistable() && jrpType.isPersisted(); // i.e. the type is valid and has a type mapping annotation + return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation } }; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractRootContextNode.java index c198d07db1..a9a0567468 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractRootContextNode.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractRootContextNode.java @@ -207,10 +207,9 @@ public abstract class AbstractRootContextNode JpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CONTEXT, new String[] {persistenceUnit.getName()}, jrcu.getFile(), - jrpt.getMappingAnnotation().getTextRange(jrcu.buildASTRoot()) + jrpt.getTextRange(jrcu.buildASTRoot()) ) ); } } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingProvider.java index ceff9b1d50..626c54a17b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingProvider.java @@ -22,15 +22,15 @@ public abstract class AbstractJavaAttributeMappingProvider /** * Default implementation. Override if the mapping provider ever applies in the default case. */ - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return false; } /** * Default implementation. Override if the mapping provider needs to do more analysis. */ - public boolean specifiedApplies(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getMappingAnnotation(getAnnotationName()) + public boolean testSpecified(JavaPersistentAttribute persistentAttribute) { + return persistentAttribute.getResourcePersistentAttribute().getAnnotation(getAnnotationName()) != null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java index 6a1502c9f3..33d35fde29 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java @@ -104,7 +104,7 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> } } - getResourcePersistentAttribute().removeSupportingAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().removeAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); fireItemRemoved(Entity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride); if (virtualAttributeOverride != null) { @@ -118,12 +118,15 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> JavaAttributeOverride newAttributeOverride = getJpaFactory().buildJavaAttributeOverride(this, this); this.specifiedAttributeOverrides.add(index, newAttributeOverride); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) getResourcePersistentAttribute().addSupportingAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + AttributeOverrideAnnotation attributeOverrideResource = + (AttributeOverrideAnnotation) getResourcePersistentAttribute().addAnnotation( + index, AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); newAttributeOverride.initialize(attributeOverrideResource); int defaultIndex = this.virtualAttributeOverrides.indexOf(oldAttributeOverride); this.virtualAttributeOverrides.remove(defaultIndex); - + newAttributeOverride.setName(oldAttributeOverride.getName()); newAttributeOverride.getColumn().setSpecifiedName(oldAttributeOverride.getColumn().getName()); @@ -175,7 +178,8 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) { CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex); - getResourcePersistentAttribute().moveSupportingAnnotation(targetIndex, sourceIndex, AttributeOverridesAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().moveAnnotation( + targetIndex, sourceIndex, AttributeOverridesAnnotation.ANNOTATION_NAME); fireItemMoved(BaseEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex); } @@ -235,7 +239,10 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> } protected void initializeAttributeOverrides() { - ListIterator<NestableAnnotation> annotations = this.resourcePersistentAttribute.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> annotations = + this.resourcePersistentAttribute.annotations( + AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); while(annotations.hasNext()) { JavaAttributeOverride attributeOverride = getJpaFactory().buildJavaAttributeOverride(this, this); @@ -264,7 +271,10 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> } protected void updateSpecifiedAttributeOverrides() { ListIterator<JavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides(); - ListIterator<NestableAnnotation> resourceAttributeOverrides = this.resourcePersistentAttribute.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceAttributeOverrides = + this.resourcePersistentAttribute.annotations( + AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); while (attributeOverrides.hasNext()) { JavaAttributeOverride attributeOverride = attributeOverrides.next(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java index ff18621605..024a6d148f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java @@ -66,7 +66,7 @@ public abstract class AbstractJavaBasicMapping extends AbstractJavaAttributeMapp } public ColumnAnnotation getResourceColumn() { - return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME); + return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); } //************** AttributeMapping implementation *************** @@ -236,13 +236,13 @@ public abstract class AbstractJavaBasicMapping extends AbstractJavaAttributeMapp } protected String getResourceConverterType() { - if (this.resourcePersistentAttribute.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME) != null) { return Converter.ENUMERATED_CONVERTER; } - else if (this.resourcePersistentAttribute.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { + else if (this.resourcePersistentAttribute.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { return Converter.TEMPORAL_CONVERTER; } - else if (this.resourcePersistentAttribute.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME) != null) { + else if (this.resourcePersistentAttribute.getAnnotation(LobAnnotation.ANNOTATION_NAME) != null) { return Converter.LOB_CONVERTER; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java index be8cd1d5ee..272d0f0cd3 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java @@ -33,7 +33,7 @@ public abstract class AbstractJavaEmbeddable return EmbeddableAnnotation.ANNOTATION_NAME; } - public Iterator<String> correspondingAnnotationNames() { + public Iterator<String> supportingAnnotationNames() { return EmptyIterator.instance(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java index 68a9e1efa2..b205bc11a8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java @@ -87,7 +87,6 @@ public abstract class AbstractJavaEntity extends AbstractJavaTypeMapping implements JavaEntity { - protected String specifiedName; protected String defaultName; @@ -238,14 +237,24 @@ public abstract class AbstractJavaEntity } protected void initializeSecondaryTables() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentType.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { - this.specifiedSecondaryTables.add(buildSecondaryTable((SecondaryTableAnnotation) stream.next())); + for (Iterator<NestableAnnotation> stream = + this.javaResourcePersistentType.annotations( + SecondaryTableAnnotation.ANNOTATION_NAME, + SecondaryTablesAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { + this.specifiedSecondaryTables.add( + buildSecondaryTable((SecondaryTableAnnotation) stream.next())); } } protected void initializePrimaryKeyJoinColumns() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentType.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { - this.specifiedPrimaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn((PrimaryKeyJoinColumnAnnotation) stream.next())); + for (Iterator<NestableAnnotation> stream = + this.javaResourcePersistentType.annotations( + PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, + PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { + this.specifiedPrimaryKeyJoinColumns.add( + buildPrimaryKeyJoinColumn((PrimaryKeyJoinColumnAnnotation) stream.next())); } } @@ -259,10 +268,15 @@ public abstract class AbstractJavaEntity } this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType)); } - + protected void initializeSpecifiedAttributeOverrides() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentType.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { - this.specifiedAttributeOverrides.add(buildAttributeOverride((AttributeOverrideAnnotation) stream.next())); + for (Iterator<NestableAnnotation> stream = + this.javaResourcePersistentType.annotations( + AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { + this.specifiedAttributeOverrides.add( + buildAttributeOverride((AttributeOverrideAnnotation) stream.next())); } } @@ -276,8 +290,13 @@ public abstract class AbstractJavaEntity } protected void initializeSpecifiedAssociationOverrides() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentType.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { - this.specifiedAssociationOverrides.add(buildAssociationOverride((AssociationOverrideAnnotation) stream.next())); + for (Iterator<NestableAnnotation> stream = + this.javaResourcePersistentType.annotations( + AssociationOverrideAnnotation.ANNOTATION_NAME, + AssociationOverridesAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { + this.specifiedAssociationOverrides.add( + buildAssociationOverride((AssociationOverrideAnnotation) stream.next())); } } @@ -295,13 +314,15 @@ public abstract class AbstractJavaEntity //You could call more than one setter before this object has received any notification //from the java resource model protected InheritanceAnnotation getResourceInheritance() { - return (InheritanceAnnotation) this.javaResourcePersistentType.getNonNullSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME); + return (InheritanceAnnotation) this.javaResourcePersistentType. + getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME); } protected DiscriminatorValueAnnotation getResourceDiscriminatorValue() { - return (DiscriminatorValueAnnotation) this.javaResourcePersistentType.getNonNullSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); + return (DiscriminatorValueAnnotation) this.javaResourcePersistentType. + getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); } - + protected void initializeIdClass() { IdClassAnnotation resourceIdClass = getResourceIdClass(); if (resourceIdClass != null) { @@ -375,7 +396,7 @@ public abstract class AbstractJavaEntity return EntityAnnotation.ANNOTATION_NAME; } - public Iterator<String> correspondingAnnotationNames() { + public Iterator<String> supportingAnnotationNames() { return new ArrayIterator<String>( JPA.TABLE, JPA.SECONDARY_TABLE, @@ -457,7 +478,11 @@ public abstract class AbstractJavaEntity public JavaSecondaryTable addSpecifiedSecondaryTable(int index) { JavaSecondaryTable secondaryTable = getJpaFactory().buildJavaSecondaryTable(this); this.specifiedSecondaryTables.add(index, secondaryTable); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + SecondaryTableAnnotation secondaryTableResource = + (SecondaryTableAnnotation) this.javaResourcePersistentType. + addAnnotation( + index, SecondaryTableAnnotation.ANNOTATION_NAME, + SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTable.initialize(secondaryTableResource); fireItemAdded(SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable); return secondaryTable; @@ -481,7 +506,8 @@ public abstract class AbstractJavaEntity public void removeSpecifiedSecondaryTable(int index) { JavaSecondaryTable removedSecondaryTable = this.specifiedSecondaryTables.remove(index); - this.javaResourcePersistentType.removeSupportingAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation( + index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); fireItemRemoved(SPECIFIED_SECONDARY_TABLES_LIST, index, removedSecondaryTable); } @@ -491,7 +517,8 @@ public abstract class AbstractJavaEntity public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) { CollectionTools.move(this.specifiedSecondaryTables, targetIndex, sourceIndex); - this.javaResourcePersistentType.moveSupportingAnnotation(targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.moveAnnotation( + targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME); fireItemMoved(SPECIFIED_SECONDARY_TABLES_LIST, targetIndex, sourceIndex); } @@ -697,7 +724,11 @@ public abstract class AbstractJavaEntity } JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner()); this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn); - PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = + (PrimaryKeyJoinColumnAnnotation) this.javaResourcePersistentType. + addAnnotation( + index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, + PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumn.initialize(pkJoinColumnResource); this.fireItemAdded(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn); if (oldDefaultPkJoinColumn != null) { @@ -726,7 +757,9 @@ public abstract class AbstractJavaEntity //in the UI because the change notifications end up in the wrong order. this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType)); } - this.javaResourcePersistentType.removeSupportingAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation( + index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, + PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); fireItemRemoved(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn); if (this.defaultPrimaryKeyJoinColumn != null) { //fire change notification if a defaultJoinColumn was created above @@ -739,7 +772,8 @@ public abstract class AbstractJavaEntity } public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.javaResourcePersistentType.moveSupportingAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.moveAnnotation( + targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); } @@ -771,7 +805,10 @@ public abstract class AbstractJavaEntity protected JavaAttributeOverride addSpecifiedAttributeOverride(int index) { JavaAttributeOverride attributeOverride = getJpaFactory().buildJavaAttributeOverride(this, createAttributeOverrideOwner()); this.specifiedAttributeOverrides.add(index, attributeOverride); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + AttributeOverrideAnnotation attributeOverrideResource = + (AttributeOverrideAnnotation) this.javaResourcePersistentType.addAnnotation( + index, AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverride.initialize(attributeOverrideResource); this.fireItemAdded(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride); return attributeOverride; @@ -804,7 +841,9 @@ public abstract class AbstractJavaEntity } } - this.javaResourcePersistentType.removeSupportingAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation( + index, AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); fireItemRemoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride); if (virtualAttributeOverride != null) { @@ -818,7 +857,10 @@ public abstract class AbstractJavaEntity JavaAttributeOverride newAttributeOverride = getJpaFactory().buildJavaAttributeOverride(this, createAttributeOverrideOwner()); this.specifiedAttributeOverrides.add(index, newAttributeOverride); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + AttributeOverrideAnnotation attributeOverrideResource = + (AttributeOverrideAnnotation) this.javaResourcePersistentType.addAnnotation( + index, AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); newAttributeOverride.initialize(attributeOverrideResource); int defaultIndex = this.virtualAttributeOverrides.indexOf(oldAttributeOverride); @@ -851,7 +893,8 @@ public abstract class AbstractJavaEntity public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) { CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex); - this.javaResourcePersistentType.moveSupportingAnnotation(targetIndex, sourceIndex, AttributeOverridesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.moveAnnotation( + targetIndex, sourceIndex, AttributeOverridesAnnotation.ANNOTATION_NAME); fireItemMoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex); } @@ -941,7 +984,10 @@ public abstract class AbstractJavaEntity public JavaAssociationOverride addSpecifiedAssociationOverride(int index) { JavaAssociationOverride associationOverride = getJpaFactory().buildJavaAssociationOverride(this, createAssociationOverrideOwner()); this.specifiedAssociationOverrides.add(index, associationOverride); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + AssociationOverrideAnnotation associationOverrideResource = + (AssociationOverrideAnnotation) this.javaResourcePersistentType.addAnnotation( + index, AssociationOverrideAnnotation.ANNOTATION_NAME, + AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverride.initialize(associationOverrideResource); this.fireItemAdded(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride); return associationOverride; @@ -965,7 +1011,8 @@ public abstract class AbstractJavaEntity public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) { CollectionTools.move(this.specifiedAssociationOverrides, targetIndex, sourceIndex); - this.javaResourcePersistentType.moveSupportingAnnotation(targetIndex, sourceIndex, AssociationOverridesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.moveAnnotation( + targetIndex, sourceIndex, AssociationOverridesAnnotation.ANNOTATION_NAME); fireItemMoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex); } @@ -996,7 +1043,9 @@ public abstract class AbstractJavaEntity } } - this.javaResourcePersistentType.removeSupportingAnnotation(index, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation( + index, AssociationOverrideAnnotation.ANNOTATION_NAME, + AssociationOverridesAnnotation.ANNOTATION_NAME); fireItemRemoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride); if (virtualAssociationOverride != null) { @@ -1010,7 +1059,10 @@ public abstract class AbstractJavaEntity JavaAssociationOverride newAssociationOverride = getJpaFactory().buildJavaAssociationOverride(this, createAssociationOverrideOwner()); this.specifiedAssociationOverrides.add(index, newAssociationOverride); - AssociationOverrideAnnotation attributeOverrideResource = (AssociationOverrideAnnotation) this.javaResourcePersistentType.addSupportingAnnotation(index, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + AssociationOverrideAnnotation attributeOverrideResource = + (AssociationOverrideAnnotation) this.javaResourcePersistentType.addAnnotation( + index, AssociationOverrideAnnotation.ANNOTATION_NAME, + AssociationOverridesAnnotation.ANNOTATION_NAME); newAssociationOverride.initialize(attributeOverrideResource); int virtualIndex = this.virtualAssociationOverrides.indexOf(oldAssociationOverride); @@ -1073,15 +1125,16 @@ public abstract class AbstractJavaEntity } protected IdClassAnnotation getResourceIdClass() { - return (IdClassAnnotation) this.javaResourcePersistentType.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + return (IdClassAnnotation) this.javaResourcePersistentType. + getAnnotation(IdClassAnnotation.ANNOTATION_NAME); } protected void addResourceIdClass() { - this.javaResourcePersistentType.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); } protected void removeResourceIdClass() { - this.javaResourcePersistentType.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME); } public Entity getParentEntity() { @@ -1519,7 +1572,9 @@ public abstract class AbstractJavaEntity protected void updateSecondaryTables() { ListIterator<JavaSecondaryTable> secondaryTables = specifiedSecondaryTables(); - ListIterator<NestableAnnotation> resourceSecondaryTables = this.javaResourcePersistentType.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceSecondaryTables = + this.javaResourcePersistentType.annotations( + SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); while (secondaryTables.hasNext()) { JavaSecondaryTable secondaryTable = secondaryTables.next(); @@ -1541,12 +1596,13 @@ public abstract class AbstractJavaEntity secondaryTable.initialize(secondaryTableResource); return secondaryTable; } - - protected void updateSpecifiedPrimaryKeyJoinColumns() { ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns(); - ListIterator<NestableAnnotation> resourcePrimaryKeyJoinColumns = this.javaResourcePersistentType.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourcePrimaryKeyJoinColumns = + this.javaResourcePersistentType.annotations( + PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, + PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); while (primaryKeyJoinColumns.hasNext()) { JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next(); @@ -1584,7 +1640,10 @@ public abstract class AbstractJavaEntity protected void updateSpecifiedAttributeOverrides() { ListIterator<JavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides(); - ListIterator<NestableAnnotation> resourceAttributeOverrides = this.javaResourcePersistentType.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceAttributeOverrides = + this.javaResourcePersistentType.annotations( + AttributeOverrideAnnotation.ANNOTATION_NAME, + AttributeOverridesAnnotation.ANNOTATION_NAME); while (attributeOverrides.hasNext()) { JavaAttributeOverride attributeOverride = attributeOverrides.next(); @@ -1640,7 +1699,10 @@ public abstract class AbstractJavaEntity protected void updateSpecifiedAssociationOverrides() { ListIterator<JavaAssociationOverride> associationOverrides = specifiedAssociationOverrides(); - ListIterator<NestableAnnotation> resourceAssociationOverrides = this.javaResourcePersistentType.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceAssociationOverrides = + this.javaResourcePersistentType.annotations( + AssociationOverrideAnnotation.ANNOTATION_NAME, + AssociationOverridesAnnotation.ANNOTATION_NAME); while (associationOverrides.hasNext()) { JavaAssociationOverride associationOverride = associationOverrides.next(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java index 9af5b6785f..e8086d5f60 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java @@ -79,7 +79,8 @@ public abstract class AbstractJavaIdMapping } public ColumnAnnotation getResourceColumn() { - return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME); + return (ColumnAnnotation) getResourcePersistentAttribute(). + getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); } //************** JavaAttributeMapping implementation *************** @@ -120,7 +121,9 @@ public abstract class AbstractJavaIdMapping throw new IllegalStateException("gemeratedValue already exists"); //$NON-NLS-1$ } this.generatedValue = getJpaFactory().buildJavaGeneratedValue(this); - GeneratedValueAnnotation generatedValueResource = (GeneratedValueAnnotation) getResourcePersistentAttribute().addSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); + GeneratedValueAnnotation generatedValueResource = + (GeneratedValueAnnotation) getResourcePersistentAttribute(). + addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); this.generatedValue.initialize(generatedValueResource); firePropertyChanged(GENERATED_VALUE_PROPERTY, null, this.generatedValue); return this.generatedValue; @@ -132,7 +135,7 @@ public abstract class AbstractJavaIdMapping } JavaGeneratedValue oldGeneratedValue = this.generatedValue; this.generatedValue = null; - getResourcePersistentAttribute().removeSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, null); } @@ -232,15 +235,18 @@ public abstract class AbstractJavaIdMapping } protected TableGeneratorAnnotation getResourceTableGenerator() { - return (TableGeneratorAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); + return (TableGeneratorAnnotation) this.resourcePersistentAttribute. + getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); } protected SequenceGeneratorAnnotation getResourceSequenceGenerator() { - return (SequenceGeneratorAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); + return (SequenceGeneratorAnnotation) this.resourcePersistentAttribute. + getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); } protected GeneratedValueAnnotation getResourceGeneratedValue() { - return (GeneratedValueAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); + return (GeneratedValueAnnotation) this.resourcePersistentAttribute. + getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); } protected JavaConverter buildSpecifiedConverter(String converterType) { @@ -251,7 +257,7 @@ public abstract class AbstractJavaIdMapping } protected String getResourceConverterType() { - if (this.resourcePersistentAttribute.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { return Converter.TEMPORAL_CONVERTER; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingProvider.java new file mode 100644 index 0000000000..8822fc03eb --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingProvider.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.JpaFactory; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.java.JavaAttributeMapping; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.resource.java.IdAnnotation; + +public abstract class AbstractJavaIdMappingProvider + extends AbstractJavaAttributeMappingProvider +{ + protected AbstractJavaIdMappingProvider() { + super(); + } + + + public String getKey() { + return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; + } + + public String getAnnotationName() { + return IdAnnotation.ANNOTATION_NAME; + } + + public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { + return factory.buildJavaIdMapping(parent); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java index d91f6bd619..b270511d72 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java @@ -13,7 +13,6 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Vector; - import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.context.JoinColumn; import org.eclipse.jpt.core.context.JoinColumnEnabledRelationshipReference; @@ -185,7 +184,7 @@ public abstract class AbstractJavaJoinColumnJoiningStrategy protected abstract void moveAnnotation(int targetIndex, int sourceIndex); - protected abstract ListIterator<JoinColumnAnnotation> joinColumnAnnotations(); + protected abstract Iterator<JoinColumnAnnotation> joinColumnAnnotations(); protected abstract JoinColumnAnnotation buildNullJoinColumnAnnotation(); @@ -198,7 +197,7 @@ public abstract class AbstractJavaJoinColumnJoiningStrategy } protected void initializeSpecifiedJoinColumns() { - ListIterator<JoinColumnAnnotation> annotations = joinColumnAnnotations(); + Iterator<JoinColumnAnnotation> annotations = joinColumnAnnotations(); while (annotations.hasNext()) { this.specifiedJoinColumns.add(buildJoinColumn(annotations.next())); } @@ -218,7 +217,7 @@ public abstract class AbstractJavaJoinColumnJoiningStrategy protected void updateSpecifiedJoinColumns() { ListIterator<JavaJoinColumn> joinColumns = specifiedJoinColumns(); - ListIterator<JoinColumnAnnotation> resourceJoinColumns = joinColumnAnnotations(); + Iterator<JoinColumnAnnotation> resourceJoinColumns = joinColumnAnnotations(); while (joinColumns.hasNext()) { JavaJoinColumn joinColumn = joinColumns.next(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java index 5c4eeb7985..eacdfea6eb 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java @@ -44,7 +44,7 @@ public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMappi return MappedSuperclassAnnotation.ANNOTATION_NAME; } - public Iterator<String> correspondingAnnotationNames() { + public Iterator<String> supportingAnnotationNames() { return new ArrayIterator<String>( JPA.ID_CLASS, JPA.EXCLUDE_DEFAULT_LISTENERS, @@ -91,15 +91,16 @@ public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMappi } protected IdClassAnnotation getResourceIdClass() { - return (IdClassAnnotation) this.javaResourcePersistentType.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + return (IdClassAnnotation) this.javaResourcePersistentType. + getAnnotation(IdClassAnnotation.ANNOTATION_NAME); } protected void addResourceIdClass() { - this.javaResourcePersistentType.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); } protected void removeResourceIdClass() { - this.javaResourcePersistentType.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentType.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java index 55f929a775..8d1b65669a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java @@ -70,15 +70,17 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi } protected OrderByAnnotation getResourceOrderBy() { - return (OrderByAnnotation) getResourcePersistentAttribute().getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + return (OrderByAnnotation) getResourcePersistentAttribute(). + getAnnotation(OrderByAnnotation.ANNOTATION_NAME); } protected OrderByAnnotation addResourceOrderBy() { - return (OrderByAnnotation) getResourcePersistentAttribute().addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + return (OrderByAnnotation) getResourcePersistentAttribute(). + addAnnotation(OrderByAnnotation.ANNOTATION_NAME); } protected void removeResourceOrderBy() { - getResourcePersistentAttribute().removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); } public boolean isNoOrdering() { @@ -165,11 +167,11 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi this.getMapKeyResource().setName(newMapKey); } else { - getResourcePersistentAttribute().removeSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME); } } else if (newMapKey != null) { - getResourcePersistentAttribute().addSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME); getMapKeyResource().setName(newMapKey); } } @@ -211,7 +213,8 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi } protected MapKeyAnnotation getMapKeyResource() { - return (MapKeyAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + return (MapKeyAnnotation) this.resourcePersistentAttribute. + getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); } public Iterator<String> candidateMapKeyNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java index 53c925d986..754c2ae595 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.core.internal.context.java; import java.util.Iterator; import java.util.List; - import org.eclipse.core.runtime.content.IContentType; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.Modifier; @@ -33,7 +32,6 @@ import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.Filter; import org.eclipse.jpt.utility.internal.ClassTools; import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.HashBag; import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -397,8 +395,8 @@ public abstract class AbstractJavaPersistentAttribute } protected JavaAttributeMapping buildDefaultMapping(JavaAttributeMappingProvider mappingProvider) { - Annotation annotation = - this.resourcePersistentAttribute.getNullMappingAnnotation(mappingProvider.getAnnotationName()); + Annotation annotation = this.resourcePersistentAttribute. + getNullAnnotation(mappingProvider.getAnnotationName()); JavaAttributeMapping mapping = mappingProvider.buildMapping(this, getJpaFactory()); mapping.initialize(annotation); return mapping; @@ -435,16 +433,13 @@ public abstract class AbstractJavaPersistentAttribute protected JavaAttributeMapping buildSpecifiedMapping() { JavaAttributeMappingProvider mappingProvider = - getJpaPlatform().getSpecifiedJavaAttributeMappingProvider(this); + getJpaPlatform().getSpecifiedJavaAttributeMappingProvider(this); return buildSpecifiedMapping(mappingProvider); } protected JavaAttributeMapping buildSpecifiedMapping(JavaAttributeMappingProvider mappingProvider) { - if (mappingProvider == null) { - return null; - } - Annotation annotation = - this.resourcePersistentAttribute.getMappingAnnotation(mappingProvider.getAnnotationName()); + Annotation annotation = this.resourcePersistentAttribute. + getAnnotation(mappingProvider.getAnnotationName()); JavaAttributeMapping mapping = mappingProvider.buildMapping(this, getJpaFactory()); // specified mappings may be null if (mapping != null) { @@ -465,24 +460,29 @@ public abstract class AbstractJavaPersistentAttribute // to the new mapping; this can't be done in the same was as XmlAttributeMapping // since we don't know all the possible mapping types public void setSpecifiedMappingKey(String key) { - if (this.valuesAreEqual(key, this.getSpecifiedMappingKey())) { + if (key == this.getSpecifiedMappingKey()) { return; } JavaAttributeMapping oldMapping = this.specifiedMapping; JavaAttributeMapping newMapping = this.buildMappingFromMappingKey(key); - + this.specifiedMapping = newMapping; - this.resourcePersistentAttribute.setMappingAnnotation((newMapping == null) ? null : newMapping.getAnnotationName()); - this.firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, oldMapping, newMapping); - - // remove "supporting annotations" that do not "support" to the new mapping - if (oldMapping != null) { - HashBag<String> annotationsToRemove = CollectionTools.collection(oldMapping.supportingAnnotationNames()); - CollectionTools.removeAll(annotationsToRemove, this.supportingAnnotationNames()); - for (String annotationName : annotationsToRemove) { - this.resourcePersistentAttribute.removeSupportingAnnotation(annotationName); - } + + String newAnnotation; + String[] newSupportingAnnotationNames; + if (newMapping != null) { + newAnnotation = newMapping.getAnnotationName(); + newSupportingAnnotationNames = + CollectionTools.array(newMapping.supportingAnnotationNames(), new String[0]); } + else { + newAnnotation = null; + newSupportingAnnotationNames = + CollectionTools.array(this.defaultMapping.supportingAnnotationNames(), new String[0]); + } + this.resourcePersistentAttribute.setPrimaryAnnotation( + newAnnotation, newSupportingAnnotationNames); + this.firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, oldMapping, newMapping); } /** @@ -518,12 +518,11 @@ public abstract class AbstractJavaPersistentAttribute protected void updateDefaultMapping() { // There will always be a mapping provider, even if it is a "null" mapping provider ... JavaAttributeMappingProvider mappingProvider = - getJpaPlatform().getDefaultJavaAttributeMappingProvider(this); + getJpaPlatform().getDefaultJavaAttributeMappingProvider(this); String mappingKey = mappingProvider.getKey(); if (this.valuesAreEqual(this.defaultMapping.getKey(), mappingKey)) { - this.defaultMapping.update( - this.resourcePersistentAttribute.getNullMappingAnnotation( - mappingProvider.getAnnotationName())); + this.defaultMapping.update(this.resourcePersistentAttribute. + getNullAnnotation(mappingProvider.getAnnotationName())); } else { setDefaultMapping(buildDefaultMapping(mappingProvider)); @@ -531,15 +530,14 @@ public abstract class AbstractJavaPersistentAttribute } protected void updateSpecifiedMapping() { - // There may not be a mapping provider ... + // There will always be a mapping provider, even if it is a "null" mapping provider ... JavaAttributeMappingProvider mappingProvider = - getJpaPlatform().getSpecifiedJavaAttributeMappingProvider(this); - // ... so there may not be a mapping annotation name - String annotationName = (mappingProvider == null) ? null : mappingProvider.getAnnotationName(); + getJpaPlatform().getSpecifiedJavaAttributeMappingProvider(this); + String mappingKey = mappingProvider.getKey(); if (this.specifiedMapping != null - && this.specifiedMapping.getAnnotationName().equals(annotationName)) { - this.specifiedMapping.update( - this.resourcePersistentAttribute.getMappingAnnotation(annotationName)); + && this.specifiedMapping.getKey().equals(mappingKey)) { + this.specifiedMapping.update(this.resourcePersistentAttribute. + getAnnotation(mappingProvider.getAnnotationName())); } else { setSpecifiedMapping(buildSpecifiedMapping(mappingProvider)); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java index 620e03381b..b77301b472 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java @@ -16,7 +16,6 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Vector; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.content.IContentType; @@ -31,8 +30,8 @@ import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.core.context.java.JavaPersistentType; import org.eclipse.jpt.core.context.java.JavaStructureNodes; import org.eclipse.jpt.core.context.java.JavaTypeMapping; +import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.internal.resource.java.source.SourceNode; -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.core.utility.TextRange; @@ -54,28 +53,34 @@ public abstract class AbstractJavaPersistentType extends AbstractJavaJpaContextNode implements JavaPersistentType { - protected String name; + protected JavaResourcePersistentType resourcePersistentType; - protected JavaTypeMapping mapping; - - protected final Vector<JavaPersistentAttribute> attributes = new Vector<JavaPersistentAttribute>(); - protected PersistentType parentPersistentType; - - protected JavaResourcePersistentType resourcePersistentType; - + + protected String name; + protected AccessType defaultAccess; + protected AccessType specifiedAccess; + + protected JavaTypeMapping mapping; + + protected final Vector<JavaPersistentAttribute> attributes = + new Vector<JavaPersistentAttribute>(); + + protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) { super(parent); this.initialize(jrpt); } + @Override public IResource getResource() { return this.resourcePersistentType.getFile(); } - + + //****************** JpaStructureNode implementation ******************* public String getId() { @@ -86,6 +91,7 @@ public abstract class AbstractJavaPersistentType return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE; } + //****************** PersistentType implementation ******************* public JavaResourcePersistentType getResourcePersistentType() { @@ -103,6 +109,30 @@ public abstract class AbstractJavaPersistentType return getParent(); } + + // **************** name ************************************************** + + public String getName() { + return this.name; + } + + public String getShortName(){ + return getName().substring(getName().lastIndexOf('.') + 1); + } + + protected void setName(String newName) { + String oldName = this.name; + this.name = newName; + firePropertyChanged(NAME_PROPERTY, oldName, newName); + } + + protected String buildName() { + return this.resourcePersistentType.getQualifiedName(); + } + + + // **************** access ************************************************ + public AccessType getAccess() { return getSpecifiedAccess() != null ? getSpecifiedAccess() : getDefaultAccess(); } @@ -117,19 +147,53 @@ public abstract class AbstractJavaPersistentType firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldAccess, newDefaultAccess); } - public String getName() { - return this.name; + public AccessType getSpecifiedAccess() { + return this.specifiedAccess; } - public String getShortName(){ - return getName().substring(getName().lastIndexOf('.') + 1); + /** + * Check the access "specified" by the java resource model. + * Check java annotations first. + * If still null check xml mapping specified access + * If still null then set to parentPersistentType access. + * If still null check entity-mappings specified access setting if this persistent-type is listed in an orm.xml file + * If still null check the persistence-unit default Access + * Default to FIELD if all else fails. + */ + protected AccessType buildDefaultAccess() { + AccessType accessType = AccessType.fromJavaResourceModel(this.resourcePersistentType.getAccess()); + if (accessType != null) { + return accessType; + } + accessType = this.getOwnerOverrideAccess(); + if (accessType != null) { + return accessType; + } + + if (this.parentPersistentType != null) { + accessType = this.parentPersistentType.getDefaultAccess(); + if (accessType != null) { + return accessType; + } + } + + accessType = this.getOwnerDefaultAccess(); + if (accessType != null) { + return accessType; + } + + // last ditch attempt to allow the user to annotate *something* + return AccessType.FIELD; } - protected void setName(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } + /** + * Build an access type based on annotations from the resource model. + * (This is platform dependent) + */ + protected abstract AccessType buildSpecifiedAccess(); + + + // **************** mapping *********************************************** public JavaTypeMapping getMapping() { return this.mapping; @@ -144,22 +208,13 @@ public abstract class AbstractJavaPersistentType return; } JavaTypeMapping oldMapping = getMapping(); - JavaTypeMapping newMapping = createJavaTypeMappingFromMappingKey(key); - - this.mapping = newMapping; - this.resourcePersistentType.setMappingAnnotation(newMapping.getAnnotationName()); + JavaTypeMapping newMapping = buildMappingFromMappingKey(key); + + this.mapping = newMapping; + this.resourcePersistentType.setPrimaryAnnotation( + newMapping.getAnnotationName(), + CollectionTools.array(newMapping.supportingAnnotationNames(), new String[0])); firePropertyChanged(PersistentType.MAPPING_PROPERTY, oldMapping, newMapping); - - if (oldMapping != null) { - Collection<String> annotationsToRemove = CollectionTools.collection(oldMapping.correspondingAnnotationNames()); - if (getMapping() != null) { - CollectionTools.removeAll(annotationsToRemove, getMapping().correspondingAnnotationNames()); - } - - for (String annotationName : annotationsToRemove) { - this.resourcePersistentType.removeSupportingAnnotation(annotationName); - } - } } protected void setMapping(JavaTypeMapping newMapping) { @@ -168,6 +223,30 @@ public abstract class AbstractJavaPersistentType firePropertyChanged(PersistentType.MAPPING_PROPERTY, oldMapping, newMapping); } + protected JavaTypeMapping buildMapping() { + JavaTypeMappingProvider mappingProvider = + getJpaPlatform().getJavaTypeMappingProvider(this); + return buildMapping(mappingProvider); + } + + protected JavaTypeMapping buildMapping(JavaTypeMappingProvider mappingProvider) { + JavaTypeMapping mapping = mappingProvider.buildMapping(this, getJpaFactory()); + // mapping may be null + if (mapping != null) { + mapping.initialize(this.resourcePersistentType); + } + return mapping; + } + + protected JavaTypeMapping buildMappingFromMappingKey(String key) { + JavaTypeMappingProvider mappingProvider = getJpaPlatform().getJavaTypeMappingProvider(key); + JavaTypeMapping mapping = mappingProvider.buildMapping(this, getJpaFactory()); + //no mapping.initialize(JavaResourcePersistentType) call here + //we do not yet have a mapping annotation so we can't call initialize + return mapping; + } + + public boolean isMapped() { return getMapping().isMapped(); } @@ -350,29 +429,22 @@ public abstract class AbstractJavaPersistentType firePropertyChanged(PersistentType.PARENT_PERSISTENT_TYPE_PROPERTY, oldParentPersistentType, newParentPersistentType); } - public boolean hasAnyAttributePersistenceAnnotations() { - return this.resourcePersistentType.hasAnyAttributePersistenceAnnotations(); + public boolean hasAnyAnnotatedAttributes() { + return this.resourcePersistentType.hasAnyAnnotatedAttributes(); } - // ******************** Updating ********************** + // **************** initialization / updating ***************************** + protected void initialize(JavaResourcePersistentType jrpt) { this.resourcePersistentType = jrpt; this.parentPersistentType = this.buildParentPersistentType(); this.name = this.buildName(); - this.initializeAccess(); - this.initializeMapping(); + this.defaultAccess = buildDefaultAccess(); + this.specifiedAccess = buildSpecifiedAccess(); + this.mapping = buildMapping(); this.initializeAttributes(); } - protected void initializeAccess() { - this.defaultAccess = this.buildDefaultAccess(); - } - - protected void initializeMapping() { - this.mapping = this.getJpaPlatform().buildJavaTypeMappingFromAnnotation(this.getJavaMappingAnnotationName(), this); - this.mapping.initialize(this.resourcePersistentType); - } - protected void initializeAttributes() { for (Iterator<JavaResourcePersistentAttribute> stream = this.resourceAttributes(); stream.hasNext(); ) { this.attributes.add(this.createAttribute(stream.next())); @@ -412,69 +484,20 @@ public abstract class AbstractJavaPersistentType } - /** - * Check the access "specified" by the java resource model. - * Check java annotations first. - * If still null check xml mapping specified access - * If still null then set to parentPersistentType access. - * If still null check entity-mappings specified access setting if this persistent-type is listed in an orm.xml file - * If still null check the persistence-unit default Access - * Default to FIELD if all else fails. - */ - protected AccessType buildDefaultAccess() { - AccessType accessType = AccessType.fromJavaResourceModel(this.resourcePersistentType.getAccess()); - if (accessType != null) { - return accessType; - } - accessType = this.getOwnerOverrideAccess(); - if (accessType != null) { - return accessType; - } - - if (this.parentPersistentType != null) { - accessType = this.parentPersistentType.getDefaultAccess(); - if (accessType != null) { - return accessType; - } - } - - accessType = this.getOwnerDefaultAccess(); - if (accessType != null) { - return accessType; - } - - // last ditch attempt to allow the user to annotate *something* - return AccessType.FIELD; - } - - protected String buildName() { - return this.resourcePersistentType.getQualifiedName(); - } - protected void updateMapping() { - String javaMappingAnnotationName = this.getJavaMappingAnnotationName(); - if (this.valuesAreEqual(this.getMapping().getAnnotationName(), javaMappingAnnotationName)) { - this.getMapping().update(this.resourcePersistentType); - } else { - this.setMapping(this.createJavaTypeMappingFromAnnotation(javaMappingAnnotationName)); + // There will always be a mapping provider, even if it is a "null" mapping provider ... + JavaTypeMappingProvider mappingProvider = + getJpaPlatform().getJavaTypeMappingProvider(this); + String mappingKey = mappingProvider.getKey(); + if (this.mapping != null + && valuesAreEqual(this.mapping.getKey(), mappingKey)) { + this.mapping.update(this.resourcePersistentType); + } + else { + setMapping(buildMapping(mappingProvider)); } } - protected JavaTypeMapping createJavaTypeMappingFromMappingKey(String key) { - return getJpaPlatform().buildJavaTypeMappingFromMappingKey(key, this); - } - - protected JavaTypeMapping createJavaTypeMappingFromAnnotation(String annotationName) { - JavaTypeMapping typeMapping = getJpaPlatform().buildJavaTypeMappingFromAnnotation(annotationName, this); - typeMapping.initialize(this.resourcePersistentType); - return typeMapping; - } - - protected String getJavaMappingAnnotationName() { - Annotation mappingAnnotation = this.resourcePersistentType.getMappingAnnotation(); - return (mappingAnnotation == null) ? null : mappingAnnotation.getAnnotationName(); - } - protected void updateAttributes() { HashBag<JavaPersistentAttribute> contextAttributesToRemove = CollectionTools.bag(this.attributes(), this.attributesSize()); ArrayList<JavaPersistentAttribute> contextAttributesToUpdate = new ArrayList<JavaPersistentAttribute>(this.attributesSize()); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java index 8ecf5b375f..f8fef674d6 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java @@ -28,6 +28,11 @@ public abstract class AbstractJavaSingleRelationshipMapping<T extends Relationsh } + @Override + public boolean isOverridableAssociationMapping() { + return true; + } + // **************** optional *********************************************** public boolean isOptional() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java index 099455724b..dc11452cf3 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java @@ -40,7 +40,7 @@ public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode } protected Annotation getResourceMappingAnnotation() { - return this.javaResourcePersistentType.getMappingAnnotation(getAnnotationName()); + return this.javaResourcePersistentType.getAnnotation(getAnnotationName()); } //***************** TypeMapping impl *************************************** diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingProvider.java new file mode 100644 index 0000000000..11c652918f --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingProvider.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; +import org.eclipse.jpt.utility.internal.StringTools; + +public abstract class AbstractJavaTypeMappingProvider + implements JavaTypeMappingProvider +{ + protected AbstractJavaTypeMappingProvider() { + super(); + } + + + /** + * Default implementation. Override if the mapping provider needs to do more analysis. + */ + public boolean test(JavaPersistentType persistentType) { + return persistentType.getResourcePersistentType().getAnnotation(getAnnotationName()) + != null; + } + + @Override + public String toString() { + return StringTools.buildToStringFor(this, this.getAnnotationName()); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java index cb3733f032..4d64b0b90f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java @@ -54,7 +54,8 @@ public abstract class AbstractJavaVersionMapping } public ColumnAnnotation getResourceColumn() { - return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME); + return (ColumnAnnotation) getResourcePersistentAttribute(). + getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); } //************** JavaAttributeMapping implementation *************** @@ -153,7 +154,7 @@ public abstract class AbstractJavaVersionMapping } protected String getResourceConverterType() { - if (this.resourcePersistentAttribute.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) { return Converter.TEMPORAL_CONVERTER; } return null; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java index e524a1ef78..8ca8fb555c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java @@ -9,7 +9,7 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.context.java; -import java.util.ListIterator; +import java.util.Iterator; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.context.BaseJoinColumn; import org.eclipse.jpt.core.context.Entity; @@ -25,7 +25,7 @@ import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation; import org.eclipse.jpt.core.resource.java.NestableAnnotation; import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.db.Table; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; +import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; public class GenericJavaJoinColumnJoiningStrategy extends AbstractJavaJoinColumnJoiningStrategy @@ -63,9 +63,10 @@ public class GenericJavaJoinColumnJoiningStrategy } @Override - protected ListIterator<JoinColumnAnnotation> joinColumnAnnotations() { - return new TransformationListIterator<NestableAnnotation, JoinColumnAnnotation>( - this.getResourcePersistentAttribute().supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)) { + protected Iterator<JoinColumnAnnotation> joinColumnAnnotations() { + return new TransformationIterator<NestableAnnotation, JoinColumnAnnotation>( + this.getResourcePersistentAttribute().annotations( + JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)) { @Override protected JoinColumnAnnotation transform(NestableAnnotation next) { return (JoinColumnAnnotation) next; @@ -81,7 +82,7 @@ public class GenericJavaJoinColumnJoiningStrategy @Override protected JoinColumnAnnotation addAnnotation(int index) { return (JoinColumnAnnotation) this.getResourcePersistentAttribute(). - addSupportingAnnotation( + addAnnotation( index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); @@ -90,7 +91,7 @@ public class GenericJavaJoinColumnJoiningStrategy @Override protected void removeAnnotation(int index) { this.getResourcePersistentAttribute(). - removeSupportingAnnotation( + removeAnnotation( index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); @@ -99,7 +100,7 @@ public class GenericJavaJoinColumnJoiningStrategy @Override protected void moveAnnotation(int targetIndex, int sourceIndex) { this.getResourcePersistentAttribute(). - moveSupportingAnnotation( + moveAnnotation( targetIndex, sourceIndex, JoinColumnsAnnotation.ANNOTATION_NAME); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java index fdcc1e2e68..8cbca2c542 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java @@ -51,13 +51,13 @@ public class GenericJavaJoinTableJoiningStrategy @Override protected JoinTableAnnotation addAnnotation() { return (JoinTableAnnotation) this.resourcePersistentAttribute. - addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); } @Override protected void removeAnnotation() { this.resourcePersistentAttribute. - removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); } @@ -80,9 +80,8 @@ public class GenericJavaJoinTableJoiningStrategy } public JoinTableAnnotation getAnnotation() { - return (JoinTableAnnotation) - this.resourcePersistentAttribute.getNonNullSupportingAnnotation( - JoinTableAnnotation.ANNOTATION_NAME); + return (JoinTableAnnotation) this.resourcePersistentAttribute. + getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java index 7b638d27f3..cb7fa70263 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java @@ -124,7 +124,7 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy protected PrimaryKeyJoinColumnAnnotation addAnnotation(int index) { return (PrimaryKeyJoinColumnAnnotation) this.resourcePersistentAttribute. - addSupportingAnnotation( + addAnnotation( index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); @@ -132,7 +132,7 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy protected void removeAnnotation(int index) { this.resourcePersistentAttribute. - removeSupportingAnnotation( + removeAnnotation( index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); @@ -140,7 +140,7 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy protected void moveAnnotation(int targetIndex, int sourceIndex) { this.resourcePersistentAttribute. - moveSupportingAnnotation( + moveAnnotation( targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); @@ -169,8 +169,8 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy } protected void initializePrimaryKeyJoinColumns() { - ListIterator<NestableAnnotation> annotations = - this.resourcePersistentAttribute.supportingAnnotations( + Iterator<NestableAnnotation> annotations = + this.resourcePersistentAttribute.annotations( PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); @@ -190,8 +190,8 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy protected void updatePrimaryKeyJoinColumns() { ListIterator<JavaPrimaryKeyJoinColumn> joinColumns = primaryKeyJoinColumns(); - ListIterator<NestableAnnotation> annotations = - this.resourcePersistentAttribute.supportingAnnotations( + Iterator<NestableAnnotation> annotations = + this.resourcePersistentAttribute.annotations( PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java index ac1b162b0d..234c3ae401 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java @@ -53,7 +53,7 @@ public class JavaBasicMappingProvider } @Override - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return persistentAttribute.typeIsBasic(); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java index a4a6bb0876..8fe2c29106 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java @@ -15,29 +15,31 @@ import org.eclipse.jpt.core.context.java.JavaEmbeddable; import org.eclipse.jpt.core.context.java.JavaPersistentType; import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; public class JavaEmbeddableProvider - implements JavaTypeMappingProvider + extends AbstractJavaTypeMappingProvider { - // singleton - private static final JavaEmbeddableProvider INSTANCE = new JavaEmbeddableProvider(); - + private static final JavaEmbeddableProvider INSTANCE = + new JavaEmbeddableProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JavaTypeMappingProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private JavaEmbeddableProvider() { super(); } - + + public String getKey() { return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; } @@ -49,10 +51,4 @@ public class JavaEmbeddableProvider public JavaEmbeddable buildMapping(JavaPersistentType parent, JpaFactory factory) { return factory.buildJavaEmbeddable(parent); } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAnnotationName()); - } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java index 696f2687e5..cb87832a56 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java @@ -53,7 +53,7 @@ public class JavaEmbeddedMappingProvider } @Override - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return persistentAttribute.getEmbeddable() != null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java index 264237e2f2..fe94c62976 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java @@ -15,32 +15,31 @@ import org.eclipse.jpt.core.context.java.JavaEntity; import org.eclipse.jpt.core.context.java.JavaPersistentType; import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; -/** - * - */ public class JavaEntityProvider - implements JavaTypeMappingProvider + extends AbstractJavaTypeMappingProvider { - // singleton - private static final JavaEntityProvider INSTANCE = new JavaEntityProvider(); - + private static final JavaEntityProvider INSTANCE = + new JavaEntityProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JavaTypeMappingProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private JavaEntityProvider() { super(); } - + + public String getKey() { return MappingKeys.ENTITY_TYPE_MAPPING_KEY; } @@ -48,14 +47,8 @@ public class JavaEntityProvider public String getAnnotationName() { return EntityAnnotation.ANNOTATION_NAME; } - + public JavaEntity buildMapping(JavaPersistentType parent, JpaFactory factory) { return factory.buildJavaEntity(parent); } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAnnotationName()); - } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java index 307a73b328..af9fd34eb6 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java @@ -9,15 +9,10 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.context.java; -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.resource.java.IdAnnotation; public class JavaIdMappingProvider - extends AbstractJavaAttributeMappingProvider + extends AbstractJavaIdMappingProvider { // singleton private static final JavaIdMappingProvider INSTANCE = @@ -38,17 +33,4 @@ public class JavaIdMappingProvider private JavaIdMappingProvider() { super(); } - - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return IdAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return factory.buildJavaIdMapping(parent); - } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java index 5c04c85f33..062af54d74 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java @@ -15,29 +15,31 @@ import org.eclipse.jpt.core.context.java.JavaMappedSuperclass; import org.eclipse.jpt.core.context.java.JavaPersistentType; import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; public class JavaMappedSuperclassProvider - implements JavaTypeMappingProvider + extends AbstractJavaTypeMappingProvider { - // singleton - private static final JavaMappedSuperclassProvider INSTANCE = new JavaMappedSuperclassProvider(); - + private static final JavaMappedSuperclassProvider INSTANCE = + new JavaMappedSuperclassProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JavaTypeMappingProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private JavaMappedSuperclassProvider() { super(); } - + + public String getKey() { return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; } @@ -45,14 +47,8 @@ public class JavaMappedSuperclassProvider public String getAnnotationName() { return MappedSuperclassAnnotation.ANNOTATION_NAME; } - + public JavaMappedSuperclass buildMapping(JavaPersistentType parent, JpaFactory factory) { return factory.buildJavaMappedSuperclass(parent); } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAnnotationName()); - } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java index 8d32a0abc8..fefecbf43f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java @@ -40,7 +40,7 @@ public class JavaNullTypeMapping extends AbstractJavaTypeMapping return false; } - public Iterator<String> correspondingAnnotationNames() { + public Iterator<String> supportingAnnotationNames() { return EmptyIterator.instance(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java index 9b11534929..bb49e25227 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java @@ -54,8 +54,8 @@ public abstract class VirtualAssociationOverrideAnnotation } @Override - protected AssociationOverrideAnnotation addSupportingAnnotation() { - return (AssociationOverrideAnnotation) super.addSupportingAnnotation(); + protected AssociationOverrideAnnotation addAnnotation() { + return (AssociationOverrideAnnotation) super.addAnnotation(); } // ***** join columns diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java index 0c8c83fdf6..25e71fa18e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java @@ -34,8 +34,8 @@ public class VirtualAttributeOverrideAnnotation } @Override - protected AttributeOverrideAnnotation addSupportingAnnotation() { - return (AttributeOverrideAnnotation) super.addSupportingAnnotation(); + protected AttributeOverrideAnnotation addAnnotation() { + return (AttributeOverrideAnnotation) super.addAnnotation(); } // ****** column diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java index d50cc088b4..01f16152ed 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java @@ -33,8 +33,8 @@ public abstract class VirtualOverrideAnnotation } @Override - protected OverrideAnnotation addSupportingAnnotation() { - return (OverrideAnnotation) super.addSupportingAnnotation(); + protected OverrideAnnotation addAnnotation() { + return (OverrideAnnotation) super.addAnnotation(); } @Override @@ -49,7 +49,7 @@ public abstract class VirtualOverrideAnnotation public void setName(String name) { if (name != null) { - this.addSupportingAnnotation().setName(name); + this.addAnnotation().setName(name); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentType.java index b475e756b9..0fcc040311 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentType.java @@ -547,7 +547,7 @@ public abstract class AbstractOrmPersistentType protected boolean javaPersistentTypeHasSpecifiedAccess() { return this.javaPersistentType.getSpecifiedAccess() != null || - this.javaPersistentType.hasAnyAttributePersistenceAnnotations(); + this.javaPersistentType.hasAnyAnnotatedAttributes(); } protected JavaPersistentType buildJavaPersistentType() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java index bae633c5e2..90217eafa2 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java @@ -67,7 +67,8 @@ public class GenericJavaDiscriminatorColumn extends AbstractJavaNamedColumn<Disc @Override protected DiscriminatorColumnAnnotation getResourceColumn() { - return (DiscriminatorColumnAnnotation) this.persistenceResource.getNonNullSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME); + return (DiscriminatorColumnAnnotation) this.persistenceResource. + getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME); } public boolean isResourceSpecified() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java index 6bba09e3a2..69c03c3f65 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java @@ -46,11 +46,11 @@ public class GenericJavaEnumeratedConverter extends AbstractJavaJpaContextNode } public void addToResourceModel() { - this.resourcePersistenceAttribute.addSupportingAnnotation(getAnnotationName()); + this.resourcePersistenceAttribute.addAnnotation(getAnnotationName()); } public void removeFromResourceModel() { - this.resourcePersistenceAttribute.removeSupportingAnnotation(getAnnotationName()); + this.resourcePersistenceAttribute.removeAnnotation(getAnnotationName()); } public EnumType getEnumType() { @@ -79,7 +79,8 @@ public class GenericJavaEnumeratedConverter extends AbstractJavaJpaContextNode } protected EnumeratedAnnotation getResourceEnumerated() { - return (EnumeratedAnnotation) this.resourcePersistenceAttribute.getSupportingAnnotation(getAnnotationName()); + return (EnumeratedAnnotation) this.resourcePersistenceAttribute. + getAnnotation(getAnnotationName()); } protected void initialize(JavaResourcePersistentAttribute jrpa) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java index 9f8a1f1339..1f4586a705 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java @@ -53,7 +53,9 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode throw new IllegalStateException("tableGenerator already exists"); //$NON-NLS-1$ } this.tableGenerator = getJpaFactory().buildJavaTableGenerator(this); - TableGeneratorAnnotation tableGeneratorResource = (TableGeneratorAnnotation) this.javaResourcePersistentMember.addSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); + TableGeneratorAnnotation tableGeneratorResource = + (TableGeneratorAnnotation) this.javaResourcePersistentMember. + addAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); this.tableGenerator.initialize(tableGeneratorResource); firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator); return this.tableGenerator; @@ -65,7 +67,7 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode } JavaTableGenerator oldTableGenerator = this.tableGenerator; this.tableGenerator = null; - this.javaResourcePersistentMember.removeSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.removeAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null); } @@ -84,7 +86,9 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode throw new IllegalStateException("sequenceGenerator already exists"); //$NON-NLS-1$ } this.sequenceGenerator = getJpaFactory().buildJavaSequenceGenerator(this); - SequenceGeneratorAnnotation sequenceGeneratorResource = (SequenceGeneratorAnnotation) this.javaResourcePersistentMember.addSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); + SequenceGeneratorAnnotation sequenceGeneratorResource = + (SequenceGeneratorAnnotation) this.javaResourcePersistentMember. + addAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); this.sequenceGenerator.initialize(sequenceGeneratorResource); firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator); return this.sequenceGenerator; @@ -96,7 +100,7 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode } JavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator; this.sequenceGenerator = null; - this.javaResourcePersistentMember.removeSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.removeAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator,null); } @@ -161,7 +165,8 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode } protected TableGeneratorAnnotation getResourceTableGenerator() { - return (TableGeneratorAnnotation) this.javaResourcePersistentMember.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); + return (TableGeneratorAnnotation) this.javaResourcePersistentMember. + getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); } protected void updateSequenceGenerator() { @@ -188,9 +193,11 @@ public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode } protected SequenceGeneratorAnnotation getResourceSequenceGenerator() { - return (SequenceGeneratorAnnotation) this.javaResourcePersistentMember.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); + return (SequenceGeneratorAnnotation) this.javaResourcePersistentMember. + getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); } + //******************** Code Completion ************************* @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java index fa8acb3516..0ab1f95469 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java @@ -44,15 +44,16 @@ public class GenericJavaLobConverter extends AbstractJavaJpaContextNode } public void addToResourceModel() { - this.resourcePersistentAttribute.addSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getAnnotationName()); } public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getAnnotationName()); } protected TemporalAnnotation getResourceLob() { - return (TemporalAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getAnnotationName()); + return (TemporalAnnotation) this.resourcePersistentAttribute. + getAnnotation(getAnnotationName()); } protected void initialize(JavaResourcePersistentAttribute jrpa) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java index 10590ddcc2..963887add8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java @@ -23,14 +23,20 @@ public class GenericJavaPersistentType } - //****************** PersistentType implementation ******************* + // **************** access type ******************************************* + /** - * GenericJavaPersistentType does not support specified access (no Access annotation in 1.0), so we return null + * GenericJavaPersistentType does not support specified access (no Access annotation in 1.0), + * so we return null */ - public AccessType getSpecifiedAccess() { + @Override + protected AccessType buildSpecifiedAccess() { return null; } + /** + * GenericJavaPersistentType does not support specified access (no Access annotation in 1.0) + */ public void setSpecifiedAccess(AccessType specifiedAccess) { throw new UnsupportedOperationException(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java index 88cea9d202..3baaedc7bc 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java @@ -70,7 +70,11 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public JavaNamedQuery addNamedQuery(int index) { JavaNamedQuery namedQuery = getJpaFactory().buildJavaNamedQuery(this); this.namedQueries.add(index, namedQuery); - NamedQueryAnnotation namedQueryAnnotation = (NamedQueryAnnotation) this.javaResourcePersistentMember.addSupportingAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation namedQueryAnnotation = + (NamedQueryAnnotation) this.javaResourcePersistentMember. + addAnnotation( + index, NamedQueryAnnotation.ANNOTATION_NAME, + NamedQueriesAnnotation.ANNOTATION_NAME); namedQuery.initialize(namedQueryAnnotation); fireItemAdded(NAMED_QUERIES_LIST, index, namedQuery); return namedQuery; @@ -90,7 +94,8 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public void removeNamedQuery(int index) { JavaNamedQuery removedNamedQuery = this.namedQueries.remove(index); - this.javaResourcePersistentMember.removeSupportingAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.removeAnnotation( + index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); fireItemRemoved(NAMED_QUERIES_LIST, index, removedNamedQuery); } @@ -100,7 +105,8 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public void moveNamedQuery(int targetIndex, int sourceIndex) { CollectionTools.move(this.namedQueries, targetIndex, sourceIndex); - this.javaResourcePersistentMember.moveSupportingAnnotation(targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.moveAnnotation( + targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME); fireItemMoved(NAMED_QUERIES_LIST, targetIndex, sourceIndex); } @@ -115,7 +121,11 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public JavaNamedNativeQuery addNamedNativeQuery(int index) { JavaNamedNativeQuery namedNativeQuery = getJpaFactory().buildJavaNamedNativeQuery(this); this.namedNativeQueries.add(index, namedNativeQuery); - NamedNativeQueryAnnotation namedNativeQueryAnnotation = (NamedNativeQueryAnnotation) this.javaResourcePersistentMember.addSupportingAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation namedNativeQueryAnnotation = + (NamedNativeQueryAnnotation) this.javaResourcePersistentMember. + addAnnotation( + index, NamedNativeQueryAnnotation.ANNOTATION_NAME, + NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedNativeQuery.initialize(namedNativeQueryAnnotation); fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery); return namedNativeQuery; @@ -135,7 +145,9 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public void removeNamedNativeQuery(int index) { JavaNamedNativeQuery removedNamedNativeQuery = this.namedNativeQueries.remove(index); - this.javaResourcePersistentMember.removeSupportingAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.removeAnnotation( + index, NamedNativeQueryAnnotation.ANNOTATION_NAME, + NamedNativeQueriesAnnotation.ANNOTATION_NAME); fireItemRemoved(NAMED_NATIVE_QUERIES_LIST, index, removedNamedNativeQuery); } @@ -145,7 +157,8 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode public void moveNamedNativeQuery(int targetIndex, int sourceIndex) { CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex); - this.javaResourcePersistentMember.moveSupportingAnnotation(targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + this.javaResourcePersistentMember.moveAnnotation( + targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME); fireItemMoved(NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex); } @@ -158,13 +171,21 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode } protected void initializeNamedQueries() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentMember.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { + for (Iterator<NestableAnnotation> stream = this.javaResourcePersistentMember. + annotations( + NamedQueryAnnotation.ANNOTATION_NAME, + NamedQueriesAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { this.namedQueries.add(buildNamedQuery((NamedQueryAnnotation) stream.next())); } } protected void initializeNamedNativeQueries() { - for (ListIterator<NestableAnnotation> stream = this.javaResourcePersistentMember.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) { + for (Iterator<NestableAnnotation> stream = this.javaResourcePersistentMember. + annotations( + NamedNativeQueryAnnotation.ANNOTATION_NAME, + NamedNativeQueriesAnnotation.ANNOTATION_NAME); + stream.hasNext(); ) { this.namedNativeQueries.add(buildNamedNativeQuery((NamedNativeQueryAnnotation) stream.next())); } } @@ -189,7 +210,10 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode protected void updateNamedQueries() { ListIterator<JavaNamedQuery> queries = namedQueries(); - ListIterator<NestableAnnotation> resourceNamedQueries = this.javaResourcePersistentMember.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceNamedQueries = + this.javaResourcePersistentMember.annotations( + NamedQueryAnnotation.ANNOTATION_NAME, + NamedQueriesAnnotation.ANNOTATION_NAME); while (queries.hasNext()) { JavaNamedQuery namedQuery = queries.next(); @@ -208,7 +232,10 @@ public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode protected void updateNamedNativeQueries() { ListIterator<JavaNamedNativeQuery> queries = namedNativeQueries(); - ListIterator<NestableAnnotation> resourceNamedNativeQueries = this.javaResourcePersistentMember.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> resourceNamedNativeQueries = + this.javaResourcePersistentMember.annotations( + NamedNativeQueryAnnotation.ANNOTATION_NAME, + NamedNativeQueriesAnnotation.ANNOTATION_NAME); while (queries.hasNext()) { JavaNamedNativeQuery namedQuery = queries.next(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java index b71cdab1e8..ec81d5fb15 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java @@ -21,9 +21,6 @@ import org.eclipse.jpt.core.resource.java.TableAnnotation; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; -/** - * - */ public class GenericJavaTable extends AbstractJavaTable implements JavaTable @@ -46,7 +43,8 @@ public class GenericJavaTable @Override protected TableAnnotation getAnnotation() { //TODO get the NullTable from the resource model or build it here in the context model?? - return (TableAnnotation) this.resourcePersistentMember.getNonNullSupportingAnnotation(getAnnotationName()); + return (TableAnnotation) this.resourcePersistentMember. + getNonNullAnnotation(getAnnotationName()); } public boolean isResourceSpecified() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java index ce7cb829f4..c52983e206 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java @@ -45,11 +45,11 @@ public class GenericJavaTemporalConverter extends AbstractJavaJpaContextNode } public void addToResourceModel() { - this.resourcePersistentAttribute.addSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getAnnotationName()); } public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getAnnotationName()); } public TemporalType getTemporalType() { @@ -71,7 +71,8 @@ public class GenericJavaTemporalConverter extends AbstractJavaJpaContextNode protected TemporalAnnotation getResourceTemporal() { - return (TemporalAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getAnnotationName()); + return (TemporalAnnotation) this.resourcePersistentAttribute. + getAnnotation(getAnnotationName()); } protected void initialize(JavaResourcePersistentAttribute jrpa) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaManyToOneMapping2_0.java new file mode 100644 index 0000000000..33d32f0720 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaManyToOneMapping2_0.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import java.util.Iterator; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMapping; +import org.eclipse.jpt.core.jpa2.context.DerivedId2_0; +import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0; +import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneMapping2_0; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; + +public abstract class AbstractJavaManyToOneMapping2_0 + extends AbstractJavaManyToOneMapping + implements JavaManyToOneMapping2_0 +{ + protected JavaDerivedId2_0 derivedId; + + + protected AbstractJavaManyToOneMapping2_0(JavaPersistentAttribute parent) { + super(parent); + this.derivedId = buildDerivedId(); + } + + + protected JavaDerivedId2_0 buildDerivedId() { + return new GenericJavaDerivedId2_0(this); + } + + @Override + public Iterator<String> supportingAnnotationNames() { + return new CompositeIterator( + super.supportingAnnotationNames(), + JPA.ID); + } + + public DerivedId2_0 getDerivedId() { + return this.derivedId; + } + + @Override + protected void initialize() { + super.initialize(); + this.derivedId.initialize(); + } + + @Override + protected void update() { + super.update(); + this.derivedId.update(); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaOneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaOneToOneMapping2_0.java new file mode 100644 index 0000000000..ac57481dd7 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaOneToOneMapping2_0.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import java.util.Iterator; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToOneMapping; +import org.eclipse.jpt.core.jpa2.context.DerivedId2_0; +import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0; +import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; + +public abstract class AbstractJavaOneToOneMapping2_0 + extends AbstractJavaOneToOneMapping + implements JavaOneToOneMapping2_0 +{ + protected JavaDerivedId2_0 derivedId; + + + protected AbstractJavaOneToOneMapping2_0(JavaPersistentAttribute parent) { + super(parent); + this.derivedId = buildDerivedId(); + } + + + protected JavaDerivedId2_0 buildDerivedId() { + return new GenericJavaDerivedId2_0(this); + } + + @Override + public Iterator<String> supportingAnnotationNames() { + return new CompositeIterator( + super.supportingAnnotationNames(), + JPA.ID); + } + + public DerivedId2_0 getDerivedId() { + return this.derivedId; + } + + @Override + protected void initialize() { + super.initialize(); + this.derivedId.initialize(); + } + + @Override + protected void update() { + super.update(); + this.derivedId.update(); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java new file mode 100644 index 0000000000..444e0d2b85 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; +import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0; +import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; +import org.eclipse.jpt.core.resource.java.IdAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.utility.TextRange; + +public class GenericJavaDerivedId2_0 + extends AbstractJavaJpaContextNode + implements JavaDerivedId2_0 +{ + protected boolean derivedId; + + + public GenericJavaDerivedId2_0(JavaSingleRelationshipMapping2_0 parent) { + super(parent); + } + + + @Override + public JavaSingleRelationshipMapping2_0 getParent() { + return (JavaSingleRelationshipMapping2_0) super.getParent(); + } + + protected JavaResourcePersistentAttribute getResourceAttribute() { + return getParent().getPersistentAttribute().getResourcePersistentAttribute(); + } + + public boolean isDerivedId() { + return this.derivedId; + } + + public void setDerivedId(boolean newDerivedId) { + if (this.derivedId == newDerivedId) { + return; + } + boolean oldDerivedId = this.derivedId; + this.derivedId = newDerivedId; + + if (newDerivedId) { + addIdAnnotation(); + } + else { + removeIdAnnotation(); + } + firePropertyChanged(DERIVED_ID_PROPERTY, oldDerivedId, newDerivedId); + } + + protected void setDerivedId_(boolean newDerivedId) { + boolean oldDerivedId = this.derivedId; + this.derivedId = newDerivedId; + firePropertyChanged(DERIVED_ID_PROPERTY, oldDerivedId, newDerivedId); + } + + protected boolean getResourceDerivedId() { + return getIdAnnotation() != null; + } + + protected IdAnnotation getIdAnnotation() { + return (IdAnnotation) getResourceAttribute().getAnnotation(JPA.ID); + } + + protected void addIdAnnotation() { + getResourceAttribute().addAnnotation(JPA.ID); + } + + protected void removeIdAnnotation() { + getResourceAttribute().removeAnnotation(JPA.ID); + } + + public void initialize() { + this.derivedId = getResourceDerivedId(); + } + + public void update() { + this.setDerivedId_(getResourceDerivedId()); + } + + public TextRange getValidationTextRange(CompilationUnit astRoot) { + IdAnnotation annotation = this.getIdAnnotation(); + return annotation == null ? null : annotation.getTextRange(astRoot); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaManyToOneMapping2_0.java new file mode 100644 index 0000000000..5e450fdd32 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaManyToOneMapping2_0.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.jpa2.context.ManyToOneMapping2_0; + +public class GenericJavaManyToOneMapping2_0 + extends AbstractJavaManyToOneMapping2_0 + implements ManyToOneMapping2_0 +{ + public GenericJavaManyToOneMapping2_0(JavaPersistentAttribute parent) { + super(parent); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0.java new file mode 100644 index 0000000000..b14c6edee7 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.jpa2.context.OneToOneMapping2_0; + +public class GenericJavaOneToOneMapping2_0 + extends AbstractJavaOneToOneMapping2_0 + implements OneToOneMapping2_0 +{ + public GenericJavaOneToOneMapping2_0(JavaPersistentAttribute parent) { + super(parent); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java index 7cd3595f97..aefe7cfc6c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java @@ -52,7 +52,9 @@ public class GenericJavaPersistentAttribute2_0 } protected AccessType buildSpecifiedAccess() { - Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.resourcePersistentAttribute.getSupportingAnnotation(Access2_0Annotation.ANNOTATION_NAME); + Access2_0Annotation accessAnnotation = + (Access2_0Annotation) this.resourcePersistentAttribute. + getAnnotation(Access2_0Annotation.ANNOTATION_NAME); return accessAnnotation == null ? null : AccessType.fromJavaResourceModel(accessAnnotation.getValue()); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java index 05d18858d6..469dc9fd33 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java @@ -23,22 +23,23 @@ public class GenericJavaPersistentType2_0 extends AbstractJavaPersistentType implements JavaPersistentType2_0 { - protected AccessType specifiedAccess; - public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) { super(parent, jrpt); } + protected Access2_0Annotation getAccessAnnotation() { - return (Access2_0Annotation) this.resourcePersistentType.getNonNullSupportingAnnotation(getAccessAnnotationName()); + return (Access2_0Annotation) this.resourcePersistentType. + getNonNullAnnotation(getAccessAnnotationName()); } - + protected String getAccessAnnotationName() { return Access2_0Annotation.ANNOTATION_NAME; } - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; + @Override + protected AccessType buildSpecifiedAccess() { + return this.getResourceAccess(); } public void setSpecifiedAccess(AccessType specifiedAccess) { @@ -62,13 +63,7 @@ public class GenericJavaPersistentType2_0 } @Override - protected void initializeAccess() { - super.initializeAccess(); - this.specifiedAccess = this.getResourceAccess(); - } - - @Override - protected void updateAccess() { + public void updateAccess() { super.updateAccess(); this.setSpecifiedAccess_(this.getResourceAccess()); } @@ -76,9 +71,8 @@ public class GenericJavaPersistentType2_0 protected AccessType getResourceAccess() { return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue()); } - + public void synchronizeStaticMetaModel() { // TODO } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingProvider2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingProvider2_0.java new file mode 100644 index 0000000000..e7ce8444b0 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingProvider2_0.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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.jpa2.context.java; + +import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMappingProvider; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation; +import org.eclipse.jpt.core.resource.java.OneToOneAnnotation; + +public class JavaIdMappingProvider2_0 + extends AbstractJavaIdMappingProvider +{ + // singleton + private static final JavaIdMappingProvider2_0 INSTANCE = + new JavaIdMappingProvider2_0(); + + + /** + * Return the singleton. + */ + public static JavaAttributeMappingProvider instance() { + return INSTANCE; + } + + + /** + * Enforce singleton usage + */ + private JavaIdMappingProvider2_0() { + super(); + } + + + @Override + public boolean testSpecified(JavaPersistentAttribute persistentAttribute) { + return super.testSpecified(persistentAttribute) && ! testDerivedId(persistentAttribute); + } + + /** + * Return whether the Id annotation, if present, is used as a supporting annotation for + * 1-1 or M-1 mapping, rather than as a primary mapping annotation + */ + protected boolean testDerivedId(JavaPersistentAttribute persistentAttribute) { + JavaResourcePersistentAttribute resourceAttribute = + persistentAttribute.getResourcePersistentAttribute(); + return resourceAttribute.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME) != null + || resourceAttribute.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME) != null; + } +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaAnnotationDefinitionProvider.java index 6ee4c837d7..44f6bb267e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaAnnotationDefinitionProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaAnnotationDefinitionProvider.java @@ -58,37 +58,35 @@ import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition; import org.eclipse.jpt.core.resource.java.AnnotationDefinition; /** - * Provides annotations for JPA 2.0, including those in JPA 1.0 + * Support for existing JPA 1.0 annotations, new JPA 2.0 annotations, and + * augmented support for annotations changed from 1.0 to 2.0 */ public class Generic2_0JpaAnnotationDefinitionProvider extends AbstractJpaAnnotationDefintionProvider { // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new Generic2_0JpaAnnotationDefinitionProvider(); - + private static final JpaAnnotationDefinitionProvider INSTANCE = + new Generic2_0JpaAnnotationDefinitionProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JpaAnnotationDefinitionProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private Generic2_0JpaAnnotationDefinitionProvider() { super(); } - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - definitions.add(EmbeddableAnnotationDefinition.instance()); - definitions.add(EntityAnnotationDefinition.instance()); - definitions.add(MappedSuperclassAnnotationDefinition.instance()); - } + @Override - protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(Access2_0AnnotationDefinition.instance()); definitions.add(AssociationOverride2_0AnnotationDefinition.instance()); definitions.add(AssociationOverrides2_0AnnotationDefinition.instance()); @@ -96,8 +94,11 @@ public class Generic2_0JpaAnnotationDefinitionProvider definitions.add(AttributeOverridesAnnotationDefinition.instance()); definitions.add(DiscriminatorColumnAnnotationDefinition.instance()); definitions.add(DiscriminatorValueAnnotationDefinition.instance()); + definitions.add(EmbeddableAnnotationDefinition.instance()); + definitions.add(EntityAnnotationDefinition.instance()); definitions.add(IdClassAnnotationDefinition.instance()); definitions.add(InheritanceAnnotationDefinition.instance()); + definitions.add(MappedSuperclassAnnotationDefinition.instance()); definitions.add(NamedQueryAnnotationDefinition.instance()); definitions.add(NamedQueriesAnnotationDefinition.instance()); definitions.add(NamedNativeQueryAnnotationDefinition.instance()); @@ -110,42 +111,37 @@ public class Generic2_0JpaAnnotationDefinitionProvider definitions.add(TableAnnotationDefinition.instance()); definitions.add(TableGeneratorAnnotationDefinition.instance()); } - - @Override - protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - definitions.add(BasicAnnotationDefinition.instance()); - definitions.add(EmbeddedAnnotationDefinition.instance()); - definitions.add(EmbeddedIdAnnotationDefinition.instance()); - definitions.add(IdAnnotationDefinition.instance()); - definitions.add(ManyToManyAnnotationDefinition.instance()); - definitions.add(ManyToOneAnnotationDefinition.instance()); - definitions.add(OneToManyAnnotationDefinition.instance()); - definitions.add(OneToOneAnnotationDefinition.instance()); - definitions.add(TransientAnnotationDefinition.instance()); - definitions.add(VersionAnnotationDefinition.instance()); - } @Override - protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(Access2_0AnnotationDefinition.instance()); definitions.add(AssociationOverride2_0AnnotationDefinition.instance()); definitions.add(AssociationOverrides2_0AnnotationDefinition.instance()); definitions.add(AttributeOverrideAnnotationDefinition.instance()); definitions.add(AttributeOverridesAnnotationDefinition.instance()); + definitions.add(BasicAnnotationDefinition.instance()); definitions.add(ColumnAnnotationDefinition.instance()); + definitions.add(EmbeddedAnnotationDefinition.instance()); + definitions.add(EmbeddedIdAnnotationDefinition.instance()); definitions.add(EnumeratedAnnotationDefinition.instance()); definitions.add(GeneratedValueAnnotationDefinition.instance()); + definitions.add(IdAnnotationDefinition.instance()); definitions.add(JoinColumnAnnotationDefinition.instance()); definitions.add(JoinColumnsAnnotationDefinition.instance()); definitions.add(JoinTableAnnotationDefinition.instance()); definitions.add(LobAnnotationDefinition.instance()); + definitions.add(ManyToManyAnnotationDefinition.instance()); + definitions.add(ManyToOneAnnotationDefinition.instance()); definitions.add(MapKeyAnnotationDefinition.instance()); + definitions.add(OneToManyAnnotationDefinition.instance()); + definitions.add(OneToOneAnnotationDefinition.instance()); definitions.add(OrderByAnnotationDefinition.instance()); definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance()); definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance()); definitions.add(SequenceGenerator2_0AnnotationDefinition.instance()); definitions.add(TableGeneratorAnnotationDefinition.instance()); definitions.add(TemporalAnnotationDefinition.instance()); + definitions.add(TransientAnnotationDefinition.instance()); + definitions.add(VersionAnnotationDefinition.instance()); } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaPlatformProvider.java index cf9cfff3e2..34fd6ba6da 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaPlatformProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/Generic2_0JpaPlatformProvider.java @@ -23,7 +23,6 @@ import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableProvider; import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingProvider; import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMappingProvider; import org.eclipse.jpt.core.internal.context.java.JavaEntityProvider; -import org.eclipse.jpt.core.internal.context.java.JavaIdMappingProvider; import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMappingProvider; import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMappingProvider; import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassProvider; @@ -35,6 +34,7 @@ import org.eclipse.jpt.core.internal.context.orm.GenericOrmMappingFileDefinition import org.eclipse.jpt.core.internal.jpa2.Orm2_0ResourceModelProvider; import org.eclipse.jpt.core.internal.jpa2.Persistence2_0ResourceModelProvider; import org.eclipse.jpt.core.internal.jpa2.context.GenericOrm2_0MappingFileDefinition; +import org.eclipse.jpt.core.internal.jpa2.context.java.JavaIdMappingProvider2_0; import org.eclipse.jpt.core.internal.platform.AbstractJpaPlatformProvider; /** @@ -111,7 +111,7 @@ public class Generic2_0JpaPlatformProvider return new JavaAttributeMappingProvider[] { JavaTransientMappingProvider.instance(), //JavaElementCollectionMappingProvider.instance(), - JavaIdMappingProvider.instance(), + JavaIdMappingProvider2_0.instance(), JavaVersionMappingProvider.instance(), JavaBasicMappingProvider.instance(), JavaEmbeddedMappingProvider.instance(), diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/GenericJpaFactory2_0.java index 4234f1c341..b5deb2865d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/GenericJpaFactory2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/platform/GenericJpaFactory2_0.java @@ -17,7 +17,6 @@ import org.eclipse.jpt.core.context.JpaRootContextNode; import org.eclipse.jpt.core.context.MappingFile; import org.eclipse.jpt.core.context.PersistentType; import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.context.PersistentType.Owner; import org.eclipse.jpt.core.context.java.JavaAssociationOverride; import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference; import org.eclipse.jpt.core.context.java.JavaAttributeMapping; @@ -63,9 +62,10 @@ import org.eclipse.jpt.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.core.context.persistence.PersistenceXml; import org.eclipse.jpt.core.internal.jpa2.GenericJpaProject2_0; import org.eclipse.jpt.core.internal.jpa2.context.GenericRootContextNode2_0; -import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJarFile2_0; import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaAssociationOverrideRelationshipReference2_0; import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0; +import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaManyToOneMapping2_0; +import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOneToOneMapping2_0; import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentAttribute2_0; import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentType2_0; import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0; @@ -99,10 +99,8 @@ import org.eclipse.jpt.core.internal.platform.AbstractJpaFactory; import org.eclipse.jpt.core.jpa2.JpaFactory2_0; import org.eclipse.jpt.core.jpa2.JpaProject2_0; import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0; -import org.eclipse.jpt.core.jpa2.context.java.JarFile2_0; import org.eclipse.jpt.core.jpa2.context.orm.OrmSequenceGenerator2_0; import org.eclipse.jpt.core.jpa2.context.persistence.ClassRef2_0; -import org.eclipse.jpt.core.jpa2.context.persistence.JarFileRef2_0; import org.eclipse.jpt.core.jpa2.context.persistence.MappingFileRef2_0; import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0; import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0; @@ -124,7 +122,6 @@ import org.eclipse.jpt.core.jpa2.resource.orm.XmlSequenceGenerator; import org.eclipse.jpt.core.jpa2.resource.orm.XmlTransient; import org.eclipse.jpt.core.jpa2.resource.orm.XmlVersion; import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.resource.orm.XmlGeneratorContainer; @@ -137,8 +134,10 @@ import org.eclipse.jpt.core.resource.persistence.XmlPersistence; import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.core.resource.xml.JpaXmlResource; + /** - * JPA 2.0 factory + * Central class that allows extenders to easily replace implementations of + * various Dali interfaces. */ public class GenericJpaFactory2_0 extends AbstractJpaFactory @@ -147,39 +146,39 @@ public class GenericJpaFactory2_0 public GenericJpaFactory2_0() { super(); } - - + + // ********** Core Model ********** @Override public JpaProject2_0 buildJpaProject(JpaProject.Config config) throws CoreException { return new GenericJpaProject2_0(config); } - - + + // ********** Context Nodes ********** - + @Override public JpaRootContextNode2_0 buildRootContextNode(JpaProject parent) { return new GenericRootContextNode2_0((JpaProject2_0) parent); } public MappingFile buildMappingFile2_0(MappingFileRef parent, JpaXmlResource resource) { - return this.buildOrmXml2_0(parent, resource); + return buildOrmXml2_0((MappingFileRef2_0) parent, resource); } - + protected GenericOrmXml2_0 buildOrmXml2_0(MappingFileRef parent, JpaXmlResource resource) { return new GenericOrmXml2_0((MappingFileRef2_0) parent, resource); } - + // ********** Persistence Context Model ********** - + @Override public PersistenceXml2_0 buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) { return new GenericPersistenceXml2_0((JpaRootContextNode2_0) parent, resource); } - + @Override public Persistence2_0 buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) { return new GenericPersistence2_0((PersistenceXml2_0) parent, xmlPersistence); @@ -189,43 +188,86 @@ public class GenericJpaFactory2_0 public PersistenceUnit2_0 buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { return new GenericPersistenceUnit2_0((Persistence2_0) parent, xmlPersistenceUnit); } - + @Override public MappingFileRef2_0 buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) { return new GenericMappingFileRef2_0((PersistenceUnit2_0) parent, xmlMappingFileRef); } - + @Override public MappingFileRef2_0 buildImpliedMappingFileRef(PersistenceUnit parent) { return new ImpliedMappingFileRef2_0((PersistenceUnit2_0) parent, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH ); } - + @Override public ClassRef2_0 buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) { return new GenericClassRef2_0((PersistenceUnit2_0) parent, classRef); } - + @Override public ClassRef2_0 buildClassRef(PersistenceUnit parent, String className) { return new GenericClassRef2_0((PersistenceUnit2_0) parent, className); } - + @Override public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { return new GenericJarFileRef2_0((PersistenceUnit2_0) parent, xmlJarFileRef); } - - - // ********** JPA 2.0 ORM Context Model ********** - + + + // ********** Java Context Model ********** + + @Override + public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) { + return new GenericJavaPersistentType2_0(owner, jrpt); + } + + @Override + public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { + return new GenericJavaPersistentAttribute2_0(parent, jrpa); + } + + @Override + public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) { + return new GenericJavaEmbeddable2_0(parent); + } + + @Override + public JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent) { + return new GenericJavaManyToOneMapping2_0(parent); + } + + @Override + public JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent) { + return new GenericJavaOneToOneMapping2_0(parent); + } + + @Override + public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent) { + return new GenericJavaSequenceGenerator2_0(parent); + } + + @Override + public JavaAssociationOverrideRelationshipReference buildJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) { + return new GenericJavaAssociationOverrideRelationshipReference2_0(parent); + } + + @Override + public AssociationOverrideAnnotation buildJavaVirtualAssociationOverrideAnnotation(JavaResourcePersistentType jrpt, String name, JoiningStrategy joiningStrategy) { + return new VirtualAssociationOverride2_0Annotation(jrpt, name, joiningStrategy); + } + + + // ********** Generic 2.0-specific ORM Context Model ********** + public EntityMappings buildEntityMappings2_0(GenericOrmXml2_0 parent, XmlEntityMappings xmlEntityMappings) { return new GenericEntityMappings2_0(parent, xmlEntityMappings); } - + public PersistenceUnitMetadata buildPersistenceUnitMetadata2_0(GenericEntityMappings2_0 parent, XmlEntityMappings xmlEntityMappings) { return new GenericPersistenceUnitMetadata2_0(parent, xmlEntityMappings); } - + public OrmPersistentType buildOrmPersistentType2_0(EntityMappings parent, XmlTypeMapping resourceMapping) { return new GenericOrmPersistentType2_0(parent, resourceMapping); } @@ -241,55 +283,55 @@ public class GenericJpaFactory2_0 public OrmMappedSuperclass buildOrmMappedSuperclass2_0(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) { return buildOrmMappedSuperclass(parent, resourceMapping); } - + public OrmPersistentAttribute buildOrmPersistentAttribute2_0(OrmPersistentType parent, OrmPersistentAttribute.Owner owner, XmlAttributeMapping resourceMapping) { return new GenericOrmPersistentAttribute2_0(parent, owner, resourceMapping); } - + public OrmBasicMapping buildOrmBasicMapping2_0(OrmPersistentAttribute parent, XmlBasic resourceMapping) { return buildOrmBasicMapping(parent, resourceMapping); } - + public OrmEmbeddedMapping buildOrmEmbeddedMapping2_0(OrmPersistentAttribute parent, XmlEmbedded resourceMapping) { return buildOrmEmbeddedMapping(parent, resourceMapping); } - + public OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping2_0(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping) { return buildOrmEmbeddedIdMapping(parent, resourceMapping); } - + public OrmIdMapping buildOrmIdMapping2_0(OrmPersistentAttribute parent, XmlId resourceMapping) { return buildOrmIdMapping(parent, resourceMapping); } - + public OrmManyToManyMapping buildOrmManyToManyMapping2_0(OrmPersistentAttribute parent, XmlManyToMany resourceMapping) { return buildOrmManyToManyMapping(parent, resourceMapping); } - + public OrmManyToOneMapping buildOrmManyToOneMapping2_0(OrmPersistentAttribute parent, XmlManyToOne resourceMapping) { return buildOrmManyToOneMapping(parent, resourceMapping); } - + public OrmOneToManyMapping buildOrmOneToManyMapping2_0(OrmPersistentAttribute parent, XmlOneToMany resourceMapping) { return buildOrmOneToManyMapping(parent, resourceMapping); } - + public OrmOneToOneMapping buildOrmOneToOneMapping2_0(OrmPersistentAttribute parent, XmlOneToOne resourceMapping) { return buildOrmOneToOneMapping(parent, resourceMapping); } - + public OrmTransientMapping buildOrmTransientMapping2_0(OrmPersistentAttribute parent, XmlTransient resourceMapping) { return buildOrmTransientMapping(parent, resourceMapping); } - + public OrmVersionMapping buildOrmVersionMapping2_0(OrmPersistentAttribute parent, XmlVersion resourceMapping) { return buildOrmVersionMapping(parent, resourceMapping); } - + public OrmAttributeMapping buildOrmNullAttributeMapping2_0(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) { return buildOrmNullAttributeMapping(parent, resourceMapping); } - + public OrmGeneratorContainer buildOrmGeneratorContainer2_0(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer) { return super.buildOrmGeneratorContainer(parent, resourceGeneratorContainer); } @@ -297,90 +339,48 @@ public class GenericJpaFactory2_0 public OrmSequenceGenerator2_0 buildOrmSequenceGenerator2_0(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) { return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator); } - + public XmlBasic buildVirtualXmlBasic2_0(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { return new VirtualXmlBasic2_0(ormTypeMapping, javaBasicMapping); } - + public XmlId buildVirtualXmlId2_0(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { return new VirtualXmlId2_0(ormTypeMapping, javaIdMapping); } - + public XmlEmbeddedId buildVirtualXmlEmbeddedId2_0(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) { return new VirtualXmlEmbeddedId2_0(ormTypeMapping, javaEmbeddedIdMapping); } - + public XmlEmbedded buildVirtualXmlEmbedded2_0(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) { return new VirtualXmlEmbedded2_0(ormTypeMapping, javaEmbeddedMapping); } - + public XmlManyToMany buildVirtualXmlManyToMany2_0(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { return new VirtualXmlManyToMany2_0(ormTypeMapping, javaManyToManyMapping); } - + public XmlManyToOne buildVirtualXmlManyToOne2_0(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { return new VirtualXmlManyToOne2_0(ormTypeMapping, javaManyToOneMapping); } - + public XmlOneToMany buildVirtualXmlOneToMany2_0(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) { return new VirtualXmlOneToMany2_0(ormTypeMapping, javaOneToManyMapping); } - + public XmlOneToOne buildVirtualXmlOneToOne2_0(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) { return new VirtualXmlOneToOne2_0(ormTypeMapping, javaOneToOneMapping); } - + public XmlTransient buildVirtualXmlTransient2_0(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) { return new VirtualXmlTransient2_0(ormTypeMapping, javaTransientMapping); } - + public XmlVersion buildVirtualXmlVersion2_0(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { return new VirtualXmlVersion2_0(ormTypeMapping, javaVersionMapping); } - + public XmlNullAttributeMapping buildVirtualXmlNullAttributeMapping2_0(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) { return new VirtualXmlNullAttributeMapping2_0(ormTypeMapping, javaAttributeMapping); } - - - // ********** Java Context Model ********** - - @Override - public JavaPersistentType buildJavaPersistentType(Owner owner, JavaResourcePersistentType jrpt) { - return new GenericJavaPersistentType2_0(owner, jrpt); - } - - @Override - public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - return new GenericJavaPersistentAttribute2_0(parent, jrpa); - } - - @Override - public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) { - return new GenericJavaEmbeddable2_0(parent); - } - - @Override - public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent) { - return new GenericJavaSequenceGenerator2_0(parent); - } - - @Override - public JavaAssociationOverrideRelationshipReference buildJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) { - return new GenericJavaAssociationOverrideRelationshipReference2_0(parent); - } - - @Override - public AssociationOverrideAnnotation buildJavaVirtualAssociationOverrideAnnotation(JavaResourcePersistentType jrpt, String name, JoiningStrategy joiningStrategy) { - return new VirtualAssociationOverride2_0Annotation(jrpt, name, joiningStrategy); - } - - - // ********** JAR Context Model ********** - - @Override - public JarFile2_0 buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) { - return new GenericJarFile2_0((JarFileRef2_0) parent, jarResourcePackageFragmentRoot); - } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java index 3e3239afaa..d3990a5aaf 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java @@ -33,8 +33,8 @@ public class NullAccess2_0Annotation } @Override - protected Access2_0Annotation addSupportingAnnotation() { - return (Access2_0Annotation) super.addSupportingAnnotation(); + protected Access2_0Annotation addAnnotation() { + return (Access2_0Annotation) super.addAnnotation(); } // ***** value @@ -44,7 +44,7 @@ public class NullAccess2_0Annotation public void setValue(AccessType value) { if (value != null) { - this.addSupportingAnnotation().setValue(value); + this.addAnnotation().setValue(value); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java index a6af8e8c69..27e2fcb276 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java @@ -14,7 +14,7 @@ import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation; import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation; import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinTableAnnotation; import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.core.jpa2.resource.java.JPA; +import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; @@ -74,7 +74,7 @@ public final class BinaryAssociationOverride2_0Annotation } private IAnnotation getJdtJoinTable() { - return (IAnnotation) this.getJdtMemberValue(JPA.ASSOCIATION_OVERRIDE__JOIN_TABLE); + return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE); } private void setJoinTable(JoinTableAnnotation column) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java index dfc227ab48..02cf8620ad 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.core.jpa2.resource.java.JPA; +import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; @@ -125,7 +125,7 @@ public final class SourceAssociationOverride2_0Annotation } static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) { - return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_TABLE, org.eclipse.jpt.core.resource.java.JPA.JOIN_TABLE); + return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, org.eclipse.jpt.core.resource.java.JPA.JOIN_TABLE); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java index a274ab4630..f1c09d3aa0 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java @@ -11,7 +11,7 @@ package org.eclipse.jpt.core.internal.jpa2.resource.java.source; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation; -import org.eclipse.jpt.core.jpa2.resource.java.JPA; +import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation; import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.core.utility.TextRange; @@ -26,11 +26,11 @@ public final class SourceSequenceGenerator2_0Annotation extends SourceSequenceGeneratorAnnotation implements SequenceGenerator2_0Annotation { - private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__CATALOG); + private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__CATALOG); private final AnnotationElementAdapter<String> catalogAdapter; private String catalog; - private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__SCHEMA); + private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__SCHEMA); private final AnnotationElementAdapter<String> schemaAdapter; private String schema; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJpaAnnotationDefintionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJpaAnnotationDefintionProvider.java index 40f73491b4..3c986adc31 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJpaAnnotationDefintionProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJpaAnnotationDefintionProvider.java @@ -10,114 +10,64 @@ package org.eclipse.jpt.core.internal.platform; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; -import java.util.ListIterator; - import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider; import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator; -/** - * - */ public abstract class AbstractJpaAnnotationDefintionProvider implements JpaAnnotationDefinitionProvider { - /** - * Ordered list of possible type mapping annotations. Ordered because this - * is used to determine the mapping in the case where 2 mapping annotations exist - */ - private AnnotationDefinition[] typeMappingAnnotationDefinitions; + private AnnotationDefinition[] typeAnnotationDefinitions; - private AnnotationDefinition[] typeSupportingAnnotationDefinitions; + private AnnotationDefinition[] attributeAnnotationDefinitions; - /** - * Ordered list of possible attribute mapping annotations. Ordered because this - * is used to determine the mapping in the case where 2 mapping annotations exist - */ - private AnnotationDefinition[] attributeMappingAnnotationDefinitions; - - private AnnotationDefinition[] attributeSupportingAnnotationDefinitions; protected AbstractJpaAnnotationDefintionProvider() { super(); } - // ********** type annotation definitions ********** - - public synchronized ListIterator<AnnotationDefinition> typeMappingAnnotationDefinitions() { - if (this.typeMappingAnnotationDefinitions == null) { - this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions(); - } - return new ArrayListIterator<AnnotationDefinition>(this.typeMappingAnnotationDefinitions); - } - - protected AnnotationDefinition[] buildTypeMappingAnnotationDefinitions() { - ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>(); - this.addTypeMappingAnnotationDefinitionsTo(definitions); - return definitions.toArray(new AnnotationDefinition[definitions.size()]); - } - /** - * Subclasses must override this to specify type mapping annotation definitions. - */ - protected abstract void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); + // ********** type annotation definitions ********** - public synchronized ListIterator<AnnotationDefinition> typeSupportingAnnotationDefinitions() { - if (this.typeSupportingAnnotationDefinitions == null) { - this.typeSupportingAnnotationDefinitions = this.buildTypeSupportingAnnotationDefinitions(); + public synchronized Iterator<AnnotationDefinition> typeAnnotationDefinitions() { + if (this.typeAnnotationDefinitions == null) { + this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions(); } - return new ArrayListIterator<AnnotationDefinition>(this.typeSupportingAnnotationDefinitions); + return new ArrayIterator<AnnotationDefinition>(this.typeAnnotationDefinitions); } - protected AnnotationDefinition[] buildTypeSupportingAnnotationDefinitions() { + protected AnnotationDefinition[] buildTypeAnnotationDefinitions() { ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>(); - this.addTypeSupportingAnnotationDefinitionsTo(definitions); + this.addTypeAnnotationDefinitionsTo(definitions); return definitions.toArray(new AnnotationDefinition[definitions.size()]); } /** - * Subclasses must override this to specify type supporting annotation definitions. + * Subclasses must override this to specify type annotation definitions. */ - protected abstract void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); + protected abstract void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); + - // ********** attribute annotation definitions ********** - public synchronized ListIterator<AnnotationDefinition> attributeMappingAnnotationDefinitions() { - if (this.attributeMappingAnnotationDefinitions == null) { - this.attributeMappingAnnotationDefinitions = this.buildAttributeMappingAnnotationDefinitions(); + public synchronized Iterator<AnnotationDefinition> attributeAnnotationDefinitions() { + if (this.attributeAnnotationDefinitions == null) { + this.attributeAnnotationDefinitions = this.buildAttributeAnnotationDefinitions(); } - return new ArrayListIterator<AnnotationDefinition>(this.attributeMappingAnnotationDefinitions); + return new ArrayListIterator<AnnotationDefinition>(this.attributeAnnotationDefinitions); } - protected AnnotationDefinition[] buildAttributeMappingAnnotationDefinitions() { + protected AnnotationDefinition[] buildAttributeAnnotationDefinitions() { ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>(); - this.addAttributeMappingAnnotationDefinitionsTo(definitions); + this.addAttributeAnnotationDefinitionsTo(definitions); return definitions.toArray(new AnnotationDefinition[definitions.size()]); } /** - * Subclasses must override this to specify attribute mapping annotation definitions. + * Subclasses must override this to specify attribute annotation definitions. */ - protected abstract void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); - - public synchronized ListIterator<AnnotationDefinition> attributeSupportingAnnotationDefinitions() { - if (this.attributeSupportingAnnotationDefinitions == null) { - this.attributeSupportingAnnotationDefinitions = this.buildAttributeSupportingAnnotationDefinitions(); - } - return new ArrayListIterator<AnnotationDefinition>(this.attributeSupportingAnnotationDefinitions); - } - - protected AnnotationDefinition[] buildAttributeSupportingAnnotationDefinitions() { - ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>(); - this.addAttributeSupportingAnnotationDefinitionsTo(definitions); - return definitions.toArray(new AnnotationDefinition[definitions.size()]); - } - - /** - * Subclasses must override this to specify attribute supporting annotation definitions. - */ - protected abstract void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); - + protected abstract void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationDefinitionProvider.java index c893b1242b..b81383b091 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationDefinitionProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationDefinitionProvider.java @@ -55,45 +55,43 @@ import org.eclipse.jpt.core.internal.resource.java.TransientAnnotationDefinition import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition; import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -/** - * - */ -public class GenericJpaAnnotationDefinitionProvider extends AbstractJpaAnnotationDefintionProvider +public class GenericJpaAnnotationDefinitionProvider + extends AbstractJpaAnnotationDefintionProvider { // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new GenericJpaAnnotationDefinitionProvider(); - + private static final JpaAnnotationDefinitionProvider INSTANCE = + new GenericJpaAnnotationDefinitionProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JpaAnnotationDefinitionProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Ensure singleton usage */ protected GenericJpaAnnotationDefinitionProvider() { super(); } - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - definitions.add(EmbeddableAnnotationDefinition.instance()); - definitions.add(EntityAnnotationDefinition.instance()); - definitions.add(MappedSuperclassAnnotationDefinition.instance()); - } - + + @Override - protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(AssociationOverrideAnnotationDefinition.instance()); definitions.add(AssociationOverridesAnnotationDefinition.instance()); definitions.add(AttributeOverrideAnnotationDefinition.instance()); definitions.add(AttributeOverridesAnnotationDefinition.instance()); definitions.add(DiscriminatorColumnAnnotationDefinition.instance()); definitions.add(DiscriminatorValueAnnotationDefinition.instance()); + definitions.add(EmbeddableAnnotationDefinition.instance()); + definitions.add(EntityAnnotationDefinition.instance()); definitions.add(IdClassAnnotationDefinition.instance()); definitions.add(InheritanceAnnotationDefinition.instance()); + definitions.add(MappedSuperclassAnnotationDefinition.instance()); definitions.add(NamedQueryAnnotationDefinition.instance()); definitions.add(NamedQueriesAnnotationDefinition.instance()); definitions.add(NamedNativeQueryAnnotationDefinition.instance()); @@ -108,39 +106,34 @@ public class GenericJpaAnnotationDefinitionProvider extends AbstractJpaAnnotatio } @Override - protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - definitions.add(BasicAnnotationDefinition.instance()); - definitions.add(EmbeddedAnnotationDefinition.instance()); - definitions.add(EmbeddedIdAnnotationDefinition.instance()); - definitions.add(IdAnnotationDefinition.instance()); - definitions.add(ManyToManyAnnotationDefinition.instance()); - definitions.add(ManyToOneAnnotationDefinition.instance()); - definitions.add(OneToManyAnnotationDefinition.instance()); - definitions.add(OneToOneAnnotationDefinition.instance()); - definitions.add(TransientAnnotationDefinition.instance()); - definitions.add(VersionAnnotationDefinition.instance()); - } - - @Override - protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(AssociationOverrideAnnotationDefinition.instance()); definitions.add(AssociationOverridesAnnotationDefinition.instance()); definitions.add(AttributeOverrideAnnotationDefinition.instance()); definitions.add(AttributeOverridesAnnotationDefinition.instance()); + definitions.add(BasicAnnotationDefinition.instance()); definitions.add(ColumnAnnotationDefinition.instance()); + definitions.add(EmbeddedAnnotationDefinition.instance()); + definitions.add(EmbeddedIdAnnotationDefinition.instance()); definitions.add(EnumeratedAnnotationDefinition.instance()); definitions.add(GeneratedValueAnnotationDefinition.instance()); + definitions.add(IdAnnotationDefinition.instance()); definitions.add(JoinColumnAnnotationDefinition.instance()); definitions.add(JoinColumnsAnnotationDefinition.instance()); definitions.add(JoinTableAnnotationDefinition.instance()); definitions.add(LobAnnotationDefinition.instance()); + definitions.add(ManyToManyAnnotationDefinition.instance()); + definitions.add(ManyToOneAnnotationDefinition.instance()); definitions.add(MapKeyAnnotationDefinition.instance()); + definitions.add(OneToManyAnnotationDefinition.instance()); + definitions.add(OneToOneAnnotationDefinition.instance()); definitions.add(OrderByAnnotationDefinition.instance()); definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance()); definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance()); definitions.add(SequenceGeneratorAnnotationDefinition.instance()); definitions.add(TableGeneratorAnnotationDefinition.instance()); definitions.add(TemporalAnnotationDefinition.instance()); + definitions.add(TransientAnnotationDefinition.instance()); + definitions.add(VersionAnnotationDefinition.instance()); } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationProvider.java index b26335f63e..d80effd8fd 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaAnnotationProvider.java @@ -9,8 +9,8 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.platform; +import java.util.Iterator; import java.util.ListIterator; - import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider; import org.eclipse.jpt.core.JpaAnnotationProvider; @@ -21,8 +21,8 @@ import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.utility.jdt.Attribute; import org.eclipse.jpt.core.utility.jdt.Type; import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator; -import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; +import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; +import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; /** * Delegate to annotation definition providers. @@ -39,8 +39,32 @@ public class GenericJpaAnnotationProvider super(); this.annotationDefinitionProviders = annotationDefinitionProviders; } - - + + + // ********** static methods ********** + + protected static Iterator<String> annotationNames( + Iterator<AnnotationDefinition> annotationDefinitions) { + return new TransformationIterator<AnnotationDefinition, String>(annotationDefinitions) { + @Override + protected String transform(AnnotationDefinition annotationDefinition) { + return annotationDefinition.getAnnotationName(); + } + }; + } + + protected static AnnotationDefinition getAnnotationDefinition( + String annotationName, Iterator<AnnotationDefinition> annotationDefinitions) { + while (annotationDefinitions.hasNext()) { + AnnotationDefinition annotationDefinition = annotationDefinitions.next(); + if (annotationDefinition.getAnnotationName().equals(annotationName)) { + return annotationDefinition; + } + } + return null; + } + + // ********** annotation definition providers ********** protected ListIterator<JpaAnnotationDefinitionProvider> annotationDefinitionProviders() { @@ -49,170 +73,93 @@ public class GenericJpaAnnotationProvider // ********** type annotations ********** - + @SuppressWarnings("unchecked") - public ListIterator<String> typeMappingAnnotationNames() { - return new CompositeListIterator<String>(annotationNames(typeMappingAnnotationDefinitions())); + public Iterator<String> typeAnnotationNames() { + return new CompositeIterator<String>( + annotationNames(typeAnnotationDefinitions())); } - - protected ListIterator<AnnotationDefinition> typeMappingAnnotationDefinitions() { - return new CompositeListIterator<AnnotationDefinition> ( - new TransformationListIterator<JpaAnnotationDefinitionProvider, ListIterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) { + + protected Iterator<AnnotationDefinition> typeAnnotationDefinitions() { + return new CompositeIterator<AnnotationDefinition> ( + new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>( + this.annotationDefinitionProviders()) { @Override - protected ListIterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.typeMappingAnnotationDefinitions(); + protected Iterator<AnnotationDefinition> transform( + JpaAnnotationDefinitionProvider annotationDefinitionProvider) { + return annotationDefinitionProvider.typeAnnotationDefinitions(); } - } - ); - } - - public Annotation buildTypeMappingAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) { - return this.getTypeMappingAnnotationDefinition(annotationName).buildAnnotation(parent, type); + }); } - public Annotation buildTypeMappingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - return this.getTypeMappingAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); + public Annotation buildTypeAnnotation( + JavaResourcePersistentType parent, Type type, String annotationName) { + return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type); } - protected AnnotationDefinition getTypeMappingAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = getAnnotationDefinition(annotationName, this.typeMappingAnnotationDefinitions()); - if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported type mapping annotation: " + annotationName); //$NON-NLS-1$ - } - return annotationDefinition; + public Annotation buildTypeAnnotation( + JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { + return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()). + buildAnnotation(parent, jdtAnnotation); } - @SuppressWarnings("unchecked") - public ListIterator<String> typeSupportingAnnotationNames() { - return new CompositeListIterator<String>(annotationNames(typeSupportingAnnotationDefinitions())); - } - - protected ListIterator<AnnotationDefinition> typeSupportingAnnotationDefinitions() { - return new CompositeListIterator<AnnotationDefinition> ( - new TransformationListIterator<JpaAnnotationDefinitionProvider, ListIterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) { - @Override - protected ListIterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.typeSupportingAnnotationDefinitions(); - } - } - ); - } - - public Annotation buildTypeSupportingAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) { - return this.getTypeSupportingAnnotationDefinition(annotationName).buildAnnotation(parent, type); - } - - public Annotation buildTypeSupportingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - return this.getTypeSupportingAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); - } - - public Annotation buildNullTypeSupportingAnnotation(JavaResourcePersistentType parent, String annotationName) { - return this.getTypeSupportingAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - - protected AnnotationDefinition getTypeSupportingAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = getAnnotationDefinition(annotationName, this.typeSupportingAnnotationDefinitions()); + protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) { + AnnotationDefinition annotationDefinition = + getAnnotationDefinition(annotationName, this.typeAnnotationDefinitions()); if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported type supporting annotation: " + annotationName); //$NON-NLS-1$ + throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$ } return annotationDefinition; } - - - // ********** attribute annotations ********** - - @SuppressWarnings("unchecked") - public ListIterator<String> attributeMappingAnnotationNames() { - return new CompositeListIterator<String>(annotationNames(attributeMappingAnnotationDefinitions())); - } - - protected ListIterator<AnnotationDefinition> attributeMappingAnnotationDefinitions() { - return new CompositeListIterator<AnnotationDefinition> ( - new TransformationListIterator<JpaAnnotationDefinitionProvider, ListIterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) { - @Override - protected ListIterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.attributeMappingAnnotationDefinitions(); - } - } - ); - } - - public Annotation buildAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) { - return this.getAttributeMappingAnnotationDefinition(annotationName).buildAnnotation(parent, attribute); - } - public Annotation buildAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - return this.getAttributeMappingAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); + public Annotation buildNullTypeAnnotation( + JavaResourcePersistentType parent, String annotationName) { + return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent); } - public Annotation buildNullAttributeMappingAnnotation(JavaResourcePersistentAttribute parent, String annotationName) { - return this.getAttributeMappingAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - protected AnnotationDefinition getAttributeMappingAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = getAnnotationDefinition(annotationName, this.attributeMappingAnnotationDefinitions()); - if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported attribute mapping annotation: " + annotationName); //$NON-NLS-1$ - } - return annotationDefinition; - } + // ********** attribute annotations ********** @SuppressWarnings("unchecked") - public ListIterator<String> attributeSupportingAnnotationNames() { - return new CompositeListIterator<String>(annotationNames(attributeSupportingAnnotationDefinitions())); + public Iterator<String> attributeAnnotationNames() { + return new CompositeIterator<String>( + annotationNames(attributeAnnotationDefinitions())); } - - protected ListIterator<AnnotationDefinition> attributeSupportingAnnotationDefinitions() { - return new CompositeListIterator<AnnotationDefinition> ( - new TransformationListIterator<JpaAnnotationDefinitionProvider, ListIterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) { + + protected Iterator<AnnotationDefinition> attributeAnnotationDefinitions() { + return new CompositeIterator<AnnotationDefinition> ( + new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>( + this.annotationDefinitionProviders()) { @Override - protected ListIterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.attributeSupportingAnnotationDefinitions(); + protected Iterator<AnnotationDefinition> transform( + JpaAnnotationDefinitionProvider annotationDefinitionProvider) { + return annotationDefinitionProvider.attributeAnnotationDefinitions(); } - } - ); + }); } - public Annotation buildAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) { - return this.getAttributeSupportingAnnotationDefinition(annotationName).buildAnnotation(parent, attribute); + public Annotation buildAttributeAnnotation( + JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) { + return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute); } - public Annotation buildAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - return this.getAttributeSupportingAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); + public Annotation buildAttributeAnnotation( + JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { + return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()). + buildAnnotation(parent, jdtAnnotation); } - public Annotation buildNullAttributeSupportingAnnotation(JavaResourcePersistentAttribute parent, String annotationName) { - return this.getAttributeSupportingAnnotationDefinition(annotationName).buildNullAnnotation(parent); + public Annotation buildNullAttributeAnnotation( + JavaResourcePersistentAttribute parent, String annotationName) { + return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent); } - protected AnnotationDefinition getAttributeSupportingAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = getAnnotationDefinition(annotationName, this.attributeSupportingAnnotationDefinitions()); + protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) { + AnnotationDefinition annotationDefinition = + getAnnotationDefinition(annotationName, this.attributeAnnotationDefinitions()); if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported attribute supporting annotation: " + annotationName); //$NON-NLS-1$ + throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$ } return annotationDefinition; } - - - // ********** static methods ********** - - protected static ListIterator<String> annotationNames(ListIterator<AnnotationDefinition> annotationDefinitions) { - return new TransformationListIterator<AnnotationDefinition, String>(annotationDefinitions) { - @Override - protected String transform(AnnotationDefinition annotationDefinition) { - return annotationDefinition.getAnnotationName(); - } - }; - } - - protected static AnnotationDefinition getAnnotationDefinition(String annotationName, ListIterator<AnnotationDefinition> annotationDefinitions) { - while (annotationDefinitions.hasNext()) { - AnnotationDefinition annotationDefinition = annotationDefinitions.next(); - if (annotationDefinition.getAnnotationName().equals(annotationName)) { - return annotationDefinition; - } - } - return null; - } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaPlatform.java index 22f24eeefb..da9a685b62 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaPlatform.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaPlatform.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.internal.platform; import java.util.ListIterator; - import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.content.IContentType; import org.eclipse.jpt.core.EntityGeneratorDatabaseAnnotationNameBuilder; @@ -19,15 +18,14 @@ import org.eclipse.jpt.core.JpaFactory; import org.eclipse.jpt.core.JpaFile; import org.eclipse.jpt.core.JpaPlatform; import org.eclipse.jpt.core.JpaPlatformProvider; +import org.eclipse.jpt.core.JpaPlatformVariation; import org.eclipse.jpt.core.JpaProject; import org.eclipse.jpt.core.JpaResourceModel; import org.eclipse.jpt.core.JpaResourceModelProvider; -import org.eclipse.jpt.core.JpaPlatformVariation; import org.eclipse.jpt.core.context.MappingFileDefinition; import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.internal.utility.PlatformTools; import org.eclipse.jpt.core.internal.utility.jdt.DefaultAnnotationEditFormatter; @@ -132,37 +130,31 @@ public class GenericJpaPlatform // ********** Java type mappings ********** - - public JavaTypeMapping buildJavaTypeMappingFromMappingKey(String key, JavaPersistentType type) { - return this.getJavaTypeMappingProviderForMappingKey(key).buildMapping(type, this.jpaFactory); - } - protected JavaTypeMappingProvider getJavaTypeMappingProviderForMappingKey(String key) { - for (JavaTypeMappingProvider provider : CollectionTools.iterable(javaTypeMappingProviders())) { - if (Tools.valuesAreEqual(provider.getKey(), key)) { + public JavaTypeMappingProvider getJavaTypeMappingProvider(JavaPersistentType type) { + for (JavaTypeMappingProvider provider : + CollectionTools.iterable(javaTypeMappingProviders())) { + if (provider.test(type)) { return provider; } } - throw new IllegalArgumentException("Illegal type mapping key: " + key); //$NON-NLS-1$ - } - - protected ListIterator<JavaTypeMappingProvider> javaTypeMappingProviders() { - return this.platformProvider.javaTypeMappingProviders(); - } - - public JavaTypeMapping buildJavaTypeMappingFromAnnotation(String annotationName, JavaPersistentType type) { - return this.getJavaTypeMappingProviderForAnnotation(annotationName).buildMapping(type, this.jpaFactory); + throw new IllegalStateException("There must be a mapping provider for all types"); //$NON-NLS-1$ } - - protected JavaTypeMappingProvider getJavaTypeMappingProviderForAnnotation(String annotationName) { - for (JavaTypeMappingProvider provider : CollectionTools.iterable(javaTypeMappingProviders())) { - if (Tools.valuesAreEqual(provider.getAnnotationName(), annotationName)) { + + public JavaTypeMappingProvider getJavaTypeMappingProvider(String mappingKey) { + for (JavaTypeMappingProvider provider : + CollectionTools.iterable(javaTypeMappingProviders())) { + if (Tools.valuesAreEqual(provider.getKey(), mappingKey)) { return provider; } } - throw new IllegalArgumentException("Illegal annotation name: " + annotationName); //$NON-NLS-1$ + throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$ } - + + protected ListIterator<JavaTypeMappingProvider> javaTypeMappingProviders() { + return this.platformProvider.javaTypeMappingProviders(); + } + // ********** Java attribute mappings ********** @@ -170,7 +162,7 @@ public class GenericJpaPlatform JavaPersistentAttribute attribute) { for (JavaAttributeMappingProvider provider : CollectionTools.iterable(defaultJavaAttributeMappingProviders())) { - if (provider.defaultApplies(attribute)) { + if (provider.testDefault(attribute)) { return provider; } } @@ -185,7 +177,7 @@ public class GenericJpaPlatform JavaPersistentAttribute attribute) { for (JavaAttributeMappingProvider provider : CollectionTools.iterable(specifiedJavaAttributeMappingProviders())) { - if (provider.specifiedApplies(attribute)) { + if (provider.testSpecified(attribute)) { return provider; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java index e61f395f62..3fc989ff90 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java @@ -65,33 +65,23 @@ public abstract class NullAnnotation } /** - * Convenience method: Set the type or attribute's mapping annotation + * Convenience method: Add the type or attribute's annotation * and return it. * Pre-condition: The annotation's parent must be a persistent member * (type or attribute). */ - protected Annotation setMappingAnnotation() { - return this.getMember().setMappingAnnotation(this.getAnnotationName()); - } - - /** - * Convenience method: Add to the type or attribute's list of "supporting" - * annotations and return the newly created annotation. - * Pre-condition: The annotation's parent must be a persistent member - * (type or attribute). - */ - protected Annotation addSupportingAnnotation() { - return this.getMember().addSupportingAnnotation(this.getAnnotationName()); + protected Annotation addAnnotation() { + return this.getMember().addAnnotation(this.getAnnotationName()); } /** - * Convenience method: Add to the type or attribute's list of "supporting" - * annotations and return the newly created annotation. + * Convenience method: Add the type or attribute's annotation + * and return it. * Pre-condition: The annotation's parent must be a persistent member * (type or attribute). */ - protected Annotation addSupportingAnnotation(JavaResourcePersistentMember.AnnotationInitializer initializer) { - return this.getMember().addSupportingAnnotation(this.getAnnotationName(), initializer); + protected Annotation addAnnotation( + JavaResourcePersistentMember.AnnotationInitializer initializer) { + return this.getMember().addAnnotation(this.getAnnotationName(), initializer); } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java index 7e458a36eb..85f0c6fe08 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java @@ -30,5 +30,4 @@ public class NullAttributeOverrideColumnAnnotation protected ColumnAnnotation addAnnotation() { return this.getAttributeOverrideAnnotation().addColumn(); } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java index 8adf3b2eef..477b7f8da0 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java @@ -27,7 +27,9 @@ public abstract class NullBaseColumnAnnotation } @Override - protected abstract BaseColumnAnnotation addAnnotation(); + protected BaseColumnAnnotation addAnnotation() { + return (BaseColumnAnnotation) super.addAnnotation(); + } // ***** table public String getTable() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java index 29babc3267..93160b0452 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java @@ -10,12 +10,9 @@ package org.eclipse.jpt.core.internal.resource.java; import java.util.ListIterator; - import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.resource.java.Annotation; import org.eclipse.jpt.core.resource.java.BaseTableAnnotation; import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer; import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation; import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; @@ -32,10 +29,11 @@ public abstract class NullBaseTableAnnotation super(parent); } - protected abstract BaseTableAnnotation addAnnotation(); + @Override + protected BaseTableAnnotation addAnnotation() { + return (BaseTableAnnotation) super.addAnnotation(); + } - protected abstract Annotation addAnnotation(AnnotationInitializer initializer); - public boolean isSpecified() { return false; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java index 4eb37a88d7..0e16de1e07 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java @@ -25,44 +25,48 @@ public final class NullBasicAnnotation protected NullBasicAnnotation(JavaResourcePersistentAttribute parent) { super(parent); } - + + public String getAnnotationName() { return ANNOTATION_NAME; } - + @Override - protected BasicAnnotation setMappingAnnotation() { - return (BasicAnnotation) super.setMappingAnnotation(); + protected BasicAnnotation addAnnotation() { + return (BasicAnnotation) super.addAnnotation(); } - + + // ***** fetch + public FetchType getFetch() { return null; } - + public void setFetch(FetchType fetch) { if (fetch != null) { - this.setMappingAnnotation().setFetch(fetch); + this.addAnnotation().setFetch(fetch); } } - + public TextRange getFetchTextRange(CompilationUnit astRoot) { return null; } - + + // ***** optional + public Boolean getOptional() { return null; } - + public void setOptional(Boolean optional) { if (optional != null) { - this.setMappingAnnotation().setOptional(optional); + this.addAnnotation().setOptional(optional); } } - + public TextRange getOptionalTextRange(CompilationUnit astRoot) { return null; } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java index 927be6ef1c..3bf5452a0b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java @@ -31,7 +31,7 @@ public class NullColumnAnnotation @Override protected ColumnAnnotation addAnnotation() { - return (ColumnAnnotation) this.addSupportingAnnotation(); + return (ColumnAnnotation) super.addAnnotation(); } // ***** length diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java index 038dc6ecf5..126ad60814 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java @@ -30,7 +30,7 @@ public final class NullDiscriminatorColumnAnnotation @Override protected DiscriminatorColumnAnnotation addAnnotation() { - return (DiscriminatorColumnAnnotation) this.addSupportingAnnotation(); + return (DiscriminatorColumnAnnotation) super.addAnnotation(); } // ***** discriminator type diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java index d8809ec50c..7a68d3d2dc 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java @@ -31,8 +31,8 @@ public final class NullDiscriminatorValueAnnotation } @Override - protected DiscriminatorValueAnnotation addSupportingAnnotation() { - return (DiscriminatorValueAnnotation) super.addSupportingAnnotation(); + protected DiscriminatorValueAnnotation addAnnotation() { + return (DiscriminatorValueAnnotation) super.addAnnotation(); } // ***** value @@ -42,7 +42,7 @@ public final class NullDiscriminatorValueAnnotation public void setValue(String value) { if (value != null) { - this.addSupportingAnnotation().setValue(value); + this.addAnnotation().setValue(value); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java index 76d961ae1c..1e45dd51a9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java @@ -31,8 +31,8 @@ public final class NullEnumeratedAnnotation } @Override - protected EnumeratedAnnotation addSupportingAnnotation() { - return (EnumeratedAnnotation) super.addSupportingAnnotation(); + protected EnumeratedAnnotation addAnnotation() { + return (EnumeratedAnnotation) super.addAnnotation(); } // ***** value @@ -42,7 +42,7 @@ public final class NullEnumeratedAnnotation public void setValue(EnumType value) { if (value != null) { - this.addSupportingAnnotation().setValue(value); + this.addAnnotation().setValue(value); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java index 5946de7915..a4130b1b6e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java @@ -31,8 +31,8 @@ public final class NullInheritanceAnnotation } @Override - protected InheritanceAnnotation addSupportingAnnotation() { - return (InheritanceAnnotation) super.addSupportingAnnotation(); + protected InheritanceAnnotation addAnnotation() { + return (InheritanceAnnotation) super.addAnnotation(); } // ***** strategy @@ -42,7 +42,7 @@ public final class NullInheritanceAnnotation public void setStrategy(InheritanceType strategy) { if (strategy != null) { - this.addSupportingAnnotation().setStrategy(strategy); + this.addAnnotation().setStrategy(strategy); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java index 3a050497b0..f54c7aac97 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java @@ -35,12 +35,12 @@ public class NullJoinTableAnnotation @Override protected JoinTableAnnotation addAnnotation() { - return (JoinTableAnnotation) this.addSupportingAnnotation(); + return (JoinTableAnnotation) super.addAnnotation(); } @Override protected JoinColumnAnnotation addAnnotation(AnnotationInitializer initializer) { - return (JoinColumnAnnotation) this.addSupportingAnnotation(initializer); + return (JoinColumnAnnotation) super.addAnnotation(initializer); } // ***** join columns diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java index ae673da038..0ae2b8cf38 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java @@ -31,9 +31,12 @@ public abstract class NullNamedColumnAnnotation public boolean isSpecified() { return false; } - - protected abstract NamedColumnAnnotation addAnnotation(); - + + @Override + protected NamedColumnAnnotation addAnnotation() { + return (NamedColumnAnnotation) super.addAnnotation(); + } + // ***** name public String getName() { return null; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java index c477cd8172..ce6374c71b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java @@ -30,8 +30,8 @@ public final class NullOneToOneAnnotation } @Override - protected OneToOneAnnotation setMappingAnnotation() { - return (OneToOneAnnotation) super.setMappingAnnotation(); + protected OneToOneAnnotation addAnnotation() { + return (OneToOneAnnotation) super.addAnnotation(); } // ***** optional @@ -41,7 +41,7 @@ public final class NullOneToOneAnnotation public void setOptional(Boolean optional) { if (optional != null) { - this.setMappingAnnotation().setOptional(optional); + this.addAnnotation().setOptional(optional); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java index a14c881e54..dd29a044d7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java @@ -26,113 +26,131 @@ public abstract class NullOwnableRelationshipMappingAnnotation protected NullOwnableRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent) { super(parent); } - + + @Override - protected OwnableRelationshipMappingAnnotation setMappingAnnotation() { - return (OwnableRelationshipMappingAnnotation) super.setMappingAnnotation(); + protected OwnableRelationshipMappingAnnotation addAnnotation() { + return (OwnableRelationshipMappingAnnotation) super.addAnnotation(); } - + + // ***** target entity + public String getTargetEntity() { return null; } - + public void setTargetEntity(String targetEntity) { if (targetEntity != null) { - this.setMappingAnnotation().setTargetEntity(targetEntity); + this.addAnnotation().setTargetEntity(targetEntity); } } - + public TextRange getTargetEntityTextRange(CompilationUnit astRoot) { return null; } - + + // ***** fully-qualified target entity class name + public String getFullyQualifiedTargetEntityClassName() { return null; } - + + // ***** mapped by + public String getMappedBy() { return null; } - + public void setMappedBy(String mappedBy) { if (mappedBy != null) { - this.setMappingAnnotation().setMappedBy(mappedBy); + this.addAnnotation().setMappedBy(mappedBy); } } - + public TextRange getMappedByTextRange(CompilationUnit astRoot) { return null; } - + public boolean mappedByTouches(int pos, CompilationUnit astRoot) { return false; } - + + // ***** fetch + public FetchType getFetch() { return null; } - + public void setFetch(FetchType fetch) { if (fetch != null) { - this.setMappingAnnotation().setFetch(fetch); + this.addAnnotation().setFetch(fetch); } } - + public TextRange getFetchTextRange(CompilationUnit astRoot) { return null; } - + + // ***** cascade all + public boolean isCascadeAll() { return false; } - + public void setCascadeAll(boolean all) { - this.setMappingAnnotation().setCascadeAll(all); + this.addAnnotation().setCascadeAll(all); } - + + // ***** cascade merge + public boolean isCascadeMerge() { return false; } - + public void setCascadeMerge(boolean merge) { - this.setMappingAnnotation().setCascadeMerge(merge); + this.addAnnotation().setCascadeMerge(merge); } - + + // ***** cascade persist + public boolean isCascadePersist() { return false; } - + public void setCascadePersist(boolean persist) { - this.setMappingAnnotation().setCascadePersist(persist); + this.addAnnotation().setCascadePersist(persist); } - + + // ***** cascade refresh + public boolean isCascadeRefresh() { return false; } - + public void setCascadeRefresh(boolean refresh) { - this.setMappingAnnotation().setCascadeRefresh(refresh); + this.addAnnotation().setCascadeRefresh(refresh); } - + + // ***** cascade remove + public boolean isCascadeRemove() { return false; } - + public void setCascadeRemove(boolean remove) { - this.setMappingAnnotation().setCascadeRemove(remove); + this.addAnnotation().setCascadeRemove(remove); } - + public TextRange getCascadeTextRange(CompilationUnit astRoot) { return null; } - } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java index 86433bedf3..bc831e7093 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java @@ -26,12 +26,12 @@ public final class NullTableAnnotation @Override protected TableAnnotation addAnnotation() { - return (TableAnnotation) addSupportingAnnotation(); + return (TableAnnotation) super.addAnnotation(); } @Override protected TableAnnotation addAnnotation(AnnotationInitializer initializer) { - return (TableAnnotation) addSupportingAnnotation(initializer); + return (TableAnnotation) super.addAnnotation(initializer); } public String getAnnotationName() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java index b661b3dc22..ec38b00a84 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java @@ -31,8 +31,8 @@ public final class NullTemporalAnnotation } @Override - protected TemporalAnnotation addSupportingAnnotation() { - return (TemporalAnnotation) super.addSupportingAnnotation(); + protected TemporalAnnotation addAnnotation() { + return (TemporalAnnotation) super.addAnnotation(); } @@ -45,7 +45,7 @@ public final class NullTemporalAnnotation public void setValue(TemporalType value) { if (value != null) { - this.addSupportingAnnotation().setValue(value); + this.addAnnotation().setValue(value); } } 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 index 3b60ab685e..734439b56d 100644 --- 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 @@ -14,7 +14,6 @@ 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; @@ -63,7 +62,7 @@ final class BinaryPackageFragment IType jdtType = jdtClassFile.getType(); if (BinaryPersistentType.typeIsPersistable(jdtType)) { JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType); - if (classFile.getPersistentType().isPersisted()) { // we only hold annotated types + if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types result.add(classFile); } } 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 index e305cebe2e..7d5c4d9725 100644 --- 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 @@ -17,7 +17,6 @@ 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; @@ -107,51 +106,37 @@ final class BinaryPersistentAttribute // ********** BinaryPersistentMember implementation ********** - + private Adapter getAdapter() { return (Adapter) this.adapter; } - - @Override - Annotation buildMappingAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildAttributeMappingAnnotation(this, jdtAnnotation); - } - + @Override - Annotation buildSupportingAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildAttributeSupportingAnnotation(this, jdtAnnotation); - } - - @Override - Annotation buildNullSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeSupportingAnnotation(this, annotationName); - } - - public Annotation getNullMappingAnnotation(String annotationName) { - return (annotationName == null) ? null : this.buildNullMappingAnnotation(annotationName); + Iterator<String> validAnnotationNames() { + return this.getAnnotationProvider().attributeAnnotationNames(); } - - private Annotation buildNullMappingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeMappingAnnotation(this, annotationName); - } - + @Override - ListIterator<String> validMappingAnnotationNames() { - return this.getAnnotationProvider().attributeMappingAnnotationNames(); + Annotation buildAnnotation(IAnnotation jdtAnnotation) { + return this.getAnnotationProvider().buildAttributeAnnotation(this, jdtAnnotation); } - + @Override - ListIterator<String> validSupportingAnnotationNames() { - return this.getAnnotationProvider().attributeSupportingAnnotationNames(); + Annotation buildNullAnnotation(String annotationName) { + return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName); } - - + + // ********** JavaResourcePersistentAttribute implementation ********** - + public String getName() { return this.getAdapter().getAttributeName(); } - + + public Annotation getNullAnnotation(String annotationName) { + return (annotationName == null) ? null : this.buildNullAnnotation(annotationName); + } + public boolean isField() { return this.getAdapter().isField(); } @@ -164,13 +149,8 @@ final class BinaryPersistentAttribute throw new UnsupportedOperationException(); } - public boolean hasAnyPersistenceAnnotations() { - return (this.mappingAnnotationsSize() > 0) - || (this.supportingAnnotationsSize() > 0); - } - public AccessType getSpecifiedAccess() { - Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getSupportingAnnotation(Access2_0Annotation.ANNOTATION_NAME); + Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME); return accessAnnotation == null ? null : accessAnnotation.getValue(); } 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 index 9d51125ed1..c8676f67c6 100644 --- 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 @@ -10,9 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java.binary; import java.util.Iterator; -import java.util.ListIterator; import java.util.Vector; - import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.JavaModelException; @@ -27,10 +25,9 @@ import org.eclipse.jpt.core.resource.java.NestableAnnotation; import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable; import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator; +import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator; /** * binary persistent member @@ -41,16 +38,13 @@ abstract class BinaryPersistentMember { /** JDT member adapter */ final Adapter adapter; - - /** mapping annotations */ - final Vector<Annotation> mappingAnnotations = new Vector<Annotation>(); - - /** supporting annotations */ - final Vector<Annotation> supportingAnnotations = new Vector<Annotation>(); - + + /** annotations */ + final Vector<Annotation> annotations = new Vector<Annotation>(); + boolean persistable; - - + + // ********** construction/initialization ********** public BinaryPersistentMember(JavaResourceNode parent, Adapter adapter) { @@ -67,121 +61,85 @@ abstract class BinaryPersistentMember } private void addAnnotation(IAnnotation jdtAnnotation) { - if (this.annotationIsValidSupportingAnnotation(jdtAnnotation)) { - this.supportingAnnotations.add(this.buildSupportingAnnotation(jdtAnnotation)); - } else if (this.annotationIsValidMappingAnnotation(jdtAnnotation)) { - this.mappingAnnotations.add(this.buildMappingAnnotation(jdtAnnotation)); + if (this.annotationIsValid(jdtAnnotation)) { + this.annotations.add(this.buildAnnotation(jdtAnnotation)); } } - - + + // ********** updating ********** - + @Override public void update() { super.update(); this.updateAnnotations(); this.setPersistable(this.buildPersistable()); } - + // TODO private void updateAnnotations() { throw new UnsupportedOperationException(); } - - - // ********** mapping annotations ********** - - public Iterator<Annotation> mappingAnnotations() { - return this.getMappingAnnotations().iterator(); - } - - private Iterable<Annotation> getMappingAnnotations() { - return new LiveCloneIterable<Annotation>(this.mappingAnnotations); - } - - public int mappingAnnotationsSize() { - return this.mappingAnnotations.size(); - } - - public Annotation getMappingAnnotation() { - Iterable<Annotation> annotations = new SnapshotCloneIterable<Annotation>(this.mappingAnnotations); - for (ListIterator<String> stream = this.validMappingAnnotationNames(); stream.hasNext();) { - Annotation annotation = this.selectAnnotationNamed(annotations, stream.next()); - if (annotation != null) { - return annotation; - } - } - return null; - } - - public Annotation getMappingAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getMappingAnnotations(), annotationName); - } - - private boolean annotationIsValidMappingAnnotation(IAnnotation jdtAnnotation) { - return CollectionTools.contains(this.validMappingAnnotationNames(), jdtAnnotation.getElementName()); - } - - abstract ListIterator<String> validMappingAnnotationNames(); - - abstract Annotation buildMappingAnnotation(IAnnotation jdtAnnotation); - - - // ********** supporting annotations ********** - - public Iterator<Annotation> supportingAnnotations() { - return this.getSupportingAnnotations().iterator(); - } - - private Iterable<Annotation> getSupportingAnnotations() { - return new LiveCloneIterable<Annotation>(this.supportingAnnotations); - } - - public int supportingAnnotationsSize() { - return this.supportingAnnotations.size(); - } - - public ListIterator<NestableAnnotation> supportingAnnotations(String nestableAnnotationName, String containerAnnotationName) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getSupportingContainerAnnotation(containerAnnotationName); + + + // ********** 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.buildNullAnnotation(annotationName); + } + + public Iterator<NestableAnnotation> annotations( + String nestableAnnotationName, String containerAnnotationName) { + ContainerAnnotation<NestableAnnotation> containerAnnotation = + getContainerAnnotation(containerAnnotationName); if (containerAnnotation != null) { return containerAnnotation.nestedAnnotations(); } - NestableAnnotation nestableAnnotation = this.getSupportingNestableAnnotation(nestableAnnotationName); + NestableAnnotation nestableAnnotation = + getNestableAnnotation(nestableAnnotationName); return (nestableAnnotation == null) ? EmptyListIterator.<NestableAnnotation>instance() : - new SingleElementListIterator<NestableAnnotation>(nestableAnnotation); - } - - private NestableAnnotation getSupportingNestableAnnotation(String annotationName) { - return (NestableAnnotation) this.getSupportingAnnotation(annotationName); - } - - public Annotation getSupportingAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getSupportingAnnotations(), annotationName); - } - - public Annotation getNonNullSupportingAnnotation(String annotationName) { - Annotation annotation = this.getSupportingAnnotation(annotationName); - return (annotation != null) ? annotation : this.buildNullSupportingAnnotation(annotationName); + new SingleElementIterator<NestableAnnotation>(nestableAnnotation); } - - abstract Annotation buildNullSupportingAnnotation(String annotationName); - - abstract Annotation buildSupportingAnnotation(IAnnotation jdtAnnotation); - - private boolean annotationIsValidSupportingAnnotation(IAnnotation jdtAnnotation) { - return CollectionTools.contains(this.validSupportingAnnotationNames(), jdtAnnotation.getElementName()); + + private NestableAnnotation getNestableAnnotation(String annotationName) { + return (NestableAnnotation) this.getAnnotation(annotationName); } - - abstract ListIterator<String> validSupportingAnnotationNames(); - + @SuppressWarnings("unchecked") - private ContainerAnnotation<NestableAnnotation> getSupportingContainerAnnotation(String annotationName) { - return (ContainerAnnotation<NestableAnnotation>) this.getSupportingAnnotation(annotationName); - } - - + 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 isPersistable() { @@ -198,8 +156,8 @@ abstract class BinaryPersistentMember return this.adapter.isPersistable(); } - public boolean isPersisted() { - return this.getMappingAnnotation() != null; + public boolean isAnnotated() { + return ! this.annotations.isEmpty(); } @@ -278,45 +236,48 @@ abstract class BinaryPersistentMember // ********** unsupported JavaResourcePersistentMember implementation ********** - - public Annotation setMappingAnnotation(String annotationName) { + + public Annotation addAnnotation(String annotationName) { throw new UnsupportedOperationException(); } - - public Annotation addSupportingAnnotation(String annotationName) { + + public Annotation addAnnotation(String annotationName, AnnotationInitializer foo) { throw new UnsupportedOperationException(); } - - public Annotation addSupportingAnnotation(String annotationName, AnnotationInitializer foo) { + + public NestableAnnotation addAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName) { throw new UnsupportedOperationException(); } - - public Annotation addSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { + + public void moveAnnotation( + int targetIndex, int sourceIndex, String containerAnnotationName) { throw new UnsupportedOperationException(); } - - public void moveSupportingAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) { + + public void removeAnnotation(String annotationName) { throw new UnsupportedOperationException(); } - - public void removeSupportingAnnotation(String annotationName) { + + public void removeAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName) { throw new UnsupportedOperationException(); } - - public void removeSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { + + public Annotation setPrimaryAnnotation( + String primaryAnnotationName, String[] supportingAnnotationNames) { throw new UnsupportedOperationException(); } - + 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 index 4f14df4511..6fa97b6b8c 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 @@ -11,9 +11,7 @@ package org.eclipse.jpt.core.internal.resource.java.binary; import java.util.Collection; import java.util.Iterator; -import java.util.ListIterator; import java.util.Vector; - import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IField; @@ -103,31 +101,21 @@ final class BinaryPersistentType // ********** BinaryPersistentMember implementation ********** @Override - Annotation buildMappingAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildTypeMappingAnnotation(this, jdtAnnotation); + Annotation buildAnnotation(IAnnotation jdtAnnotation) { + return this.getAnnotationProvider().buildTypeAnnotation(this, jdtAnnotation); } @Override - Annotation buildSupportingAnnotation(IAnnotation jdtAnnotation) { - return this.getAnnotationProvider().buildTypeSupportingAnnotation(this, jdtAnnotation); + Annotation buildNullAnnotation(String annotationName) { + return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName); } @Override - Annotation buildNullSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullTypeSupportingAnnotation(this, annotationName); + Iterator<String> validAnnotationNames() { + return this.getAnnotationProvider().typeAnnotationNames(); } - @Override - ListIterator<String> validMappingAnnotationNames() { - return this.getAnnotationProvider().typeMappingAnnotationNames(); - } - @Override - ListIterator<String> validSupportingAnnotationNames() { - return this.getAnnotationProvider().typeSupportingAnnotationNames(); - } - - // ********** JavaResourcePersistentType implementation ********** // ***** name @@ -218,13 +206,13 @@ final class BinaryPersistentType private AccessType buildAccess() { return JPTTools.buildAccess(this); } - + /** * check only persistable attributes */ - public boolean hasAnyAttributePersistenceAnnotations() { + public boolean hasAnyAnnotatedAttributes() { for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) { - if (stream.next().hasAnyPersistenceAnnotations()) { + if (stream.next().isAnnotated()) { return true; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java index 0129138e8e..32901780c1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java @@ -17,7 +17,6 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Vector; - import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.ITypeBinding; @@ -150,69 +149,53 @@ final class SourcePersistentAttribute // ******** AbstractJavaResourcePersistentMember implementation ******** - - @Override - Annotation buildMappingAnnotation(String mappingAnnotationName) { - return this.getAnnotationProvider().buildAttributeMappingAnnotation(this, this.member, mappingAnnotationName); - } - - @Override - Annotation buildSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildAttributeSupportingAnnotation(this, this.member, annotationName); - } - + @Override - Annotation buildNullSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeSupportingAnnotation(this, annotationName); - } - - public Annotation getNullMappingAnnotation(String annotationName) { - return (annotationName == null) ? null : this.buildNullMappingAnnotation(annotationName); + Iterator<String> validAnnotationNames() { + return this.getAnnotationProvider().attributeAnnotationNames(); } - - private Annotation buildNullMappingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeMappingAnnotation(this, annotationName); - } - + @Override - ListIterator<String> validMappingAnnotationNames() { - return this.getAnnotationProvider().attributeMappingAnnotationNames(); + Annotation buildAnnotation(String annotationName) { + return this.getAnnotationProvider(). + buildAttributeAnnotation(this, this.member, annotationName); } - + @Override - ListIterator<String> validSupportingAnnotationNames() { - return this.getAnnotationProvider().attributeSupportingAnnotationNames(); + Annotation buildNullAnnotation(String annotationName) { + return this.getAnnotationProvider(). + buildNullAttributeAnnotation(this, annotationName); } - + public boolean isFor(MethodSignature signature, int occurrence) { return ((MethodAttribute) this.member).matches(signature, occurrence); } - - + + // ******** JavaResourcePersistentAttribute implementation ******** - + public String getName() { return this.member.getAttributeName(); } - + + public Annotation getNullAnnotation(String annotationName) { + return (annotationName == null) ? null : this.buildNullAnnotation(annotationName); + } + public boolean isField() { return this.member.isField(); } - + public boolean isProperty() { return ! this.isField(); } - - public boolean hasAnyPersistenceAnnotations() { - return (this.mappingAnnotationsSize() > 0) - || (this.supportingAnnotationsSize() > 0); - } - + public AccessType getSpecifiedAccess() { - Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getSupportingAnnotation(Access2_0Annotation.ANNOTATION_NAME); + Access2_0Annotation accessAnnotation = + (Access2_0Annotation) getAnnotation(Access2_0Annotation.ANNOTATION_NAME); return (accessAnnotation == null) ? null : accessAnnotation.getValue(); } - + public boolean typeIsSubTypeOf(String tn) { if (this.typeName == null) { return false; @@ -221,15 +204,16 @@ final class SourcePersistentAttribute || this.typeInterfaceNames.contains(tn) || this.typeSuperclassNames.contains(tn); } - + public boolean typeIsVariablePrimitive() { return (this.typeName != null) && ClassTools.classNamedIsVariablePrimitive(this.typeName); } - + private ITypeBinding getTypeBinding(CompilationUnit astRoot) { return this.member.getTypeBinding(astRoot); } - + + // ***** modifiers public int getModifiers() { return this.modifiers; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java index d780239ebb..c4bee2e3ce 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java @@ -9,15 +9,11 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.resource.java.source; -import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; -import java.util.ListIterator; import java.util.Set; import java.util.Vector; - import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.BodyDeclaration; @@ -36,10 +32,9 @@ import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.core.utility.jdt.Member; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; +import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator; +import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator; /** * Java source persistent member (annotations, "persistable") @@ -49,38 +44,31 @@ abstract class SourcePersistentMember<E extends Member> implements JavaResourcePersistentMember { final E member; - - /** - * mapping annotations; no duplicates (java compiler has an error for - * duplicates) - */ - final Vector<Annotation> mappingAnnotations = new Vector<Annotation>(); - + /** - * supporting annotations; no duplicates (java compiler has an error for - * duplicates) + * annotations; no duplicates (java compiler has an error for duplicates) */ - final Vector<Annotation> supportingAnnotations = new Vector<Annotation>(); - + final Vector<Annotation> annotations = new Vector<Annotation>(); + boolean persistable; - - + + // ********** construction/initialization ********** - + SourcePersistentMember(JavaResourceNode parent, E member) { super(parent); this.member = member; } - + public void initialize(CompilationUnit astRoot) { this.member.getBodyDeclaration(astRoot).accept(this.buildInitialAnnotationVisitor(astRoot)); this.persistable = this.buildPersistable(astRoot); } - + private ASTVisitor buildInitialAnnotationVisitor(CompilationUnit astRoot) { return new InitialAnnotationVisitor(astRoot, this.member.getBodyDeclaration(astRoot)); } - + /** * called from InitialAnnotationVisitor */ @@ -89,207 +77,82 @@ abstract class SourcePersistentMember<E extends Member> if (jdtAnnotationName == null) { return; } - if (this.annotationIsValidSupportingAnnotation(jdtAnnotationName)) { - if (this.selectAnnotationNamed(this.supportingAnnotations, jdtAnnotationName) == null) { // ignore duplicates - Annotation annotation = this.buildSupportingAnnotation(jdtAnnotationName); - annotation.initialize(astRoot); - this.supportingAnnotations.add(annotation); - } - } else if (this.annotationIsValidMappingAnnotation(jdtAnnotationName)) { - if (this.selectAnnotationNamed(this.mappingAnnotations, jdtAnnotationName) == null) { // ignore duplicates - Annotation annotation = this.buildMappingAnnotation(jdtAnnotationName); + if (this.annotationIsValid(jdtAnnotationName)) { + if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates + Annotation annotation = this.buildAnnotation(jdtAnnotationName); annotation.initialize(astRoot); - this.mappingAnnotations.add(annotation); + this.annotations.add(annotation); } } } - - - // ********** mapping annotations ********** - - public Iterator<Annotation> mappingAnnotations() { - return this.getMappingAnnotations().iterator(); + + + // ********** annotations ********** + + public Iterator<Annotation> annotations() { + return this.getAnnotations().iterator(); } - - private Iterable<Annotation> getMappingAnnotations() { - return new LiveCloneIterable<Annotation>(this.mappingAnnotations); + + private Iterable<Annotation> getAnnotations() { + return new LiveCloneIterable<Annotation>(this.annotations); } - - public int mappingAnnotationsSize() { - return this.mappingAnnotations.size(); + + public int annotationsSize() { + return this.annotations.size(); } - - // TODO need property change notification on this mappingAnnotation changing - // from the context model we don't really care if their are multiple mapping - // annotations, just which one we need to use - public Annotation getMappingAnnotation() { - Iterable<Annotation> annotations = new SnapshotCloneIterable<Annotation>(this.mappingAnnotations); - for (ListIterator<String> stream = this.validMappingAnnotationNames(); stream.hasNext();) { - Annotation annotation = this.selectAnnotationNamed(annotations, stream.next()); - if (annotation != null) { - return annotation; - } - } - return null; + + public Annotation getAnnotation(String annotationName) { + return this.selectAnnotationNamed(this.getAnnotations(), annotationName); } - - public Annotation getMappingAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getMappingAnnotations(), annotationName); + + public Annotation getNonNullAnnotation(String annotationName) { + Annotation annotation = this.getAnnotation(annotationName); + return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName); } - - /** - * Remove all other *mapping* annotations that exist; not just the one - * returned by #getMappingAnnotation(). #getMappingAnnotation() returns the - * first mapping annotation found in the source. If there were multiple - * mapping annotations (which is a validation error) then calling this - * method would not work because the new mapping annotation would be added - * to the end of the list of annotations. - */ - public Annotation setMappingAnnotation(String annotationName) { - Collection<Annotation> removedAnnotations = null; - Annotation newMapping = null; - if (annotationName == null) { - removedAnnotations = this.removeMappingAnnotations(); - } else { - if (this.selectAnnotationNamed(this.mappingAnnotations, annotationName) != null) { - throw new IllegalStateException("duplicate mapping annotation: " + annotationName); //$NON-NLS-1$ - } - removedAnnotations = this.removeMappingAnnotations(); - - newMapping = this.buildMappingAnnotation(annotationName); - this.mappingAnnotations.add(newMapping); - newMapping.newAnnotation(); - this.fireItemAdded(MAPPING_ANNOTATIONS_COLLECTION, newMapping); + public Iterator<NestableAnnotation> annotations( + String nestableAnnotationName, String containerAnnotationName) { + ContainerAnnotation<NestableAnnotation> containerAnnotation = + this.getContainerAnnotation(containerAnnotationName); + if (containerAnnotation != null) { + return containerAnnotation.nestedAnnotations(); } - // hold change notifications until the end so a project update does not - // occur before we are finished removing the old mapping(s) and/or adding - // the new mapping - this.fireItemsRemoved(MAPPING_ANNOTATIONS_COLLECTION, removedAnnotations); - return newMapping; - } - - /** - * Remove all mapping annotations that already exist. No change notification - * is fired. Return the removed annotations. - */ - private Collection<Annotation> removeMappingAnnotations() { - ArrayList<Annotation> removedAnnotations = null; - for (String mappingAnnotationName : CollectionTools.iterable(this.validMappingAnnotationNames())) { - Annotation mappingAnnotation = this.selectAnnotationNamed(this.mappingAnnotations, mappingAnnotationName); - if (mappingAnnotation != null) { - // only need to delete one, since we do not hold duplicates - this.mappingAnnotations.remove(mappingAnnotation); - mappingAnnotation.removeAnnotation(); - if (removedAnnotations == null) { - removedAnnotations = new ArrayList<Annotation>(); - } - removedAnnotations.add(mappingAnnotation); - } + NestableAnnotation nestableAnnotation = + getNestableAnnotation(nestableAnnotationName); + if (nestableAnnotation != null) { + return new SingleElementIterator<NestableAnnotation>(nestableAnnotation); } - return (removedAnnotations != null) ? removedAnnotations : Collections.<Annotation>emptySet(); - } - - abstract Annotation buildMappingAnnotation(String mappingAnnotationName); - - private boolean annotationIsValidMappingAnnotation(String annotationName) { - return CollectionTools.contains(this.validMappingAnnotationNames(), annotationName); + return EmptyIterator.instance(); } - - abstract ListIterator<String> validMappingAnnotationNames(); - - - // ********** supporting annotations ********** - - public Iterator<Annotation> supportingAnnotations() { - return this.getSupportingAnnotations().iterator(); - } - - private Iterable<Annotation> getSupportingAnnotations() { - return new LiveCloneIterable<Annotation>(this.supportingAnnotations); - } - - public int supportingAnnotationsSize() { - return this.supportingAnnotations.size(); - } - - public Annotation getSupportingAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getSupportingAnnotations(), annotationName); + + // minimize scope of suppressed warnings + @SuppressWarnings("unchecked") + private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) { + return (ContainerAnnotation<NestableAnnotation>) getAnnotation(annotationName); } - - public Annotation getNonNullSupportingAnnotation(String annotationName) { - Annotation annotation = this.getSupportingAnnotation(annotationName); - return (annotation != null) ? annotation : this.buildNullSupportingAnnotation(annotationName); + + private NestableAnnotation getNestableAnnotation(String annotationName) { + return (NestableAnnotation) this.getAnnotation(annotationName); } - - abstract Annotation buildNullSupportingAnnotation(String annotationName); - - public Annotation addSupportingAnnotation(String annotationName) { - Annotation annotation = this.buildSupportingAnnotation(annotationName); - this.supportingAnnotations.add(annotation); + + public Annotation addAnnotation(String annotationName) { + Annotation annotation = this.buildAnnotation(annotationName); + this.annotations.add(annotation); annotation.newAnnotation(); - this.fireItemAdded(SUPPORTING_ANNOTATIONS_COLLECTION, annotation); + this.fireItemAdded(ANNOTATIONS_COLLECTION, annotation); return annotation; } - - public Annotation addSupportingAnnotation(String annotationName, AnnotationInitializer annotationInitializer) { - Annotation annotation = this.buildSupportingAnnotation(annotationName); - this.supportingAnnotations.add(annotation); + + public Annotation addAnnotation(String annotationName, AnnotationInitializer annotationInitializer) { + Annotation annotation = this.buildAnnotation(annotationName); + this.annotations.add(annotation); annotation.newAnnotation(); Annotation nestedAnnotation = annotationInitializer.initializeAnnotation(annotation); nestedAnnotation.newAnnotation(); - this.fireItemAdded(SUPPORTING_ANNOTATIONS_COLLECTION, annotation); + this.fireItemAdded(ANNOTATIONS_COLLECTION, annotation); return nestedAnnotation; } - - abstract Annotation buildSupportingAnnotation(String annotationName); - - public void removeSupportingAnnotation(String annotationName) { - Annotation annotation = this.getSupportingAnnotation(annotationName); - if (annotation != null) { - this.removeSupportingAnnotation(annotation); - } - } - - private void removeSupportingAnnotation(Annotation annotation) { - this.supportingAnnotations.remove(annotation); - annotation.removeAnnotation(); - this.fireItemRemoved(SUPPORTING_ANNOTATIONS_COLLECTION, annotation); - } - - private boolean annotationIsValidSupportingAnnotation(String annotationName) { - return CollectionTools.contains(this.validSupportingAnnotationNames(), annotationName); - } - - abstract ListIterator<String> validSupportingAnnotationNames(); - - - // ********** supporting "combo" annotations ********** - - public ListIterator<NestableAnnotation> supportingAnnotations(String nestableAnnotationName, String containerAnnotationName) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getSupportingContainerAnnotation(containerAnnotationName); - if (containerAnnotation != null) { - return containerAnnotation.nestedAnnotations(); - } - - NestableAnnotation nestableAnnotation = this.getSupportingNestableAnnotation(nestableAnnotationName); - if (nestableAnnotation != null) { - return new SingleElementListIterator<NestableAnnotation>(nestableAnnotation); - } - - return EmptyListIterator.instance(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private ContainerAnnotation<NestableAnnotation> getSupportingContainerAnnotation(String annotationName) { - return (ContainerAnnotation<NestableAnnotation>) this.getSupportingAnnotation(annotationName); - } - - private NestableAnnotation getSupportingNestableAnnotation(String annotationName) { - return (NestableAnnotation) this.getSupportingAnnotation(annotationName); - } - + /** * 1. check for a container annotation; * if it is present, add a nested annotation to it @@ -299,19 +162,20 @@ abstract class SourcePersistentMember<E extends Member> * add a container annotation and move the stand-alone nested annotation to it * and add a new nested annotation to it also */ - public NestableAnnotation addSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getSupportingContainerAnnotation(containerAnnotationName); + public NestableAnnotation addAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName) { + ContainerAnnotation<NestableAnnotation> containerAnnotation = + getContainerAnnotation(containerAnnotationName); if (containerAnnotation != null) { // ignore any stand-alone nestable annotations and just add to the container annotation return AnnotationContainerTools.addNestedAnnotation(index, containerAnnotation); } - - NestableAnnotation standAloneAnnotation = this.getSupportingNestableAnnotation(nestableAnnotationName); + NestableAnnotation standAloneAnnotation = + getNestableAnnotation(nestableAnnotationName); if (standAloneAnnotation == null) { // add a stand-alone nestable annotation since neither the nestable nor the container exist - return (NestableAnnotation) this.addSupportingAnnotation(nestableAnnotationName); + return (NestableAnnotation) this.addAnnotation(nestableAnnotationName); } - // move the stand-alone nestable annotation to a container and add another nestable return this.addSecondNestedAnnotation(index, containerAnnotationName, standAloneAnnotation); } @@ -325,21 +189,20 @@ abstract class SourcePersistentMember<E extends Member> * place when the context model gets an "update" and looks at the resource * model to determine what has changed */ - private NestableAnnotation addSecondNestedAnnotation(int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.buildSupportingContainerAnnotation(containerAnnotationName); - this.supportingAnnotations.add(containerAnnotation); + private NestableAnnotation addSecondNestedAnnotation( + int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) { + ContainerAnnotation<NestableAnnotation> containerAnnotation = + buildContainerAnnotation(containerAnnotationName); + this.annotations.add(containerAnnotation); containerAnnotation.newAnnotation(); - + NestableAnnotation nestedAnnotation0 = containerAnnotation.addNestedAnnotationInternal(); nestedAnnotation0.newAnnotation(); - NestableAnnotation nestedAnnotation1 = containerAnnotation.addNestedAnnotationInternal(); nestedAnnotation1.newAnnotation(); - - this.removeSupportingAnnotation(standAloneAnnotation); - - this.fireItemAdded(SUPPORTING_ANNOTATIONS_COLLECTION, containerAnnotation); - + this.removeAnnotation(standAloneAnnotation); + this.fireItemAdded(ANNOTATIONS_COLLECTION, containerAnnotation); + if (index == 0) { // adding new annotation at 0, so stand-alone is "copied" to slot 1 nestedAnnotation1.initializeFrom(standAloneAnnotation); @@ -347,43 +210,57 @@ abstract class SourcePersistentMember<E extends Member> // adding new annotation at 1, so stand-alone is "copied" to slot 0 nestedAnnotation0.initializeFrom(standAloneAnnotation); } - + return (index == 0) ? nestedAnnotation0 : nestedAnnotation1; } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private ContainerAnnotation<NestableAnnotation> buildSupportingContainerAnnotation(String annotationName) { - return (ContainerAnnotation<NestableAnnotation>) this.buildSupportingAnnotation(annotationName); - } - - public void moveSupportingAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) { - this.moveAnnotation(targetIndex, sourceIndex, this.getSupportingContainerAnnotation(containerAnnotationName)); + + public void moveAnnotation( + int targetIndex, int sourceIndex, String containerAnnotationName) { + moveAnnotation(targetIndex, sourceIndex, getContainerAnnotation(containerAnnotationName)); } - - private void moveAnnotation(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) { + + private void moveAnnotation( + int targetIndex, int sourceIndex, + ContainerAnnotation<NestableAnnotation> containerAnnotation) { AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, containerAnnotation); } - public void removeSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getSupportingContainerAnnotation(containerAnnotationName); + public void removeAnnotation(String annotationName) { + Annotation annotation = getAnnotation(annotationName); + if (annotation != null) { + this.removeAnnotation(annotation); + } + } + + private void removeAnnotation(Annotation annotation) { + this.annotations.remove(annotation); + annotation.removeAnnotation(); + this.fireItemRemoved(ANNOTATIONS_COLLECTION, annotation); + } + + public void removeAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName) { + ContainerAnnotation<NestableAnnotation> containerAnnotation = + getContainerAnnotation(containerAnnotationName); if (containerAnnotation == null) { // assume the index is 0 - this.removeSupportingAnnotation(this.getSupportingAnnotation(nestableAnnotationName)); - } else { - this.removeSupportingAnnotation(index, containerAnnotation); + removeAnnotation(getAnnotation(nestableAnnotationName)); + } + else { + removeAnnotation(index, containerAnnotation); } } - + /** * after we remove the nested annotation, check to see whether we need to * either remove the container (if it is empty) or convert the last nested * annotation to a stand-alone annotation */ - private void removeSupportingAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) { + private void removeAnnotation( + int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) { AnnotationContainerTools.removeNestedAnnotation(index, containerAnnotation); switch (containerAnnotation.nestedAnnotationsSize()) { case 0: - this.removeSupportingAnnotation(containerAnnotation); + this.removeAnnotation(containerAnnotation); break; case 1: this.convertLastNestedAnnotation(containerAnnotation); @@ -402,128 +279,163 @@ abstract class SourcePersistentMember<E extends Member> * place when the context model gets an "update" and looks at the resource * model to determine what has changed */ - private void convertLastNestedAnnotation(ContainerAnnotation<NestableAnnotation> containerAnnotation) { + private void convertLastNestedAnnotation( + ContainerAnnotation<NestableAnnotation> containerAnnotation) { NestableAnnotation lastNestedAnnotation = containerAnnotation.nestedAnnotations().next(); - this.supportingAnnotations.remove(containerAnnotation); + annotations.remove(containerAnnotation); containerAnnotation.removeAnnotation(); - - NestableAnnotation standAloneAnnotation = (NestableAnnotation) this.buildSupportingAnnotation(lastNestedAnnotation.getAnnotationName()); - this.supportingAnnotations.add(standAloneAnnotation); + + NestableAnnotation standAloneAnnotation = + buildNestableAnnotation(lastNestedAnnotation.getAnnotationName()); + this.annotations.add(standAloneAnnotation); standAloneAnnotation.newAnnotation(); - this.fireItemRemoved(SUPPORTING_ANNOTATIONS_COLLECTION, containerAnnotation); - this.fireItemAdded(SUPPORTING_ANNOTATIONS_COLLECTION, standAloneAnnotation); + this.fireItemRemoved(ANNOTATIONS_COLLECTION, containerAnnotation); + this.fireItemAdded(ANNOTATIONS_COLLECTION, standAloneAnnotation); standAloneAnnotation.initializeFrom(lastNestedAnnotation); } - - + + public Annotation setPrimaryAnnotation( + String primaryAnnotationName, String[] supportingAnnotationNames) { + Annotation newPrimaryAnnotation = null; + String[] annotationNamesToKeep = supportingAnnotationNames; + if (primaryAnnotationName != null) { + annotationNamesToKeep = CollectionTools.add(supportingAnnotationNames, primaryAnnotationName); + } + for (Annotation existingAnnotation : getAnnotations()) { + if (! CollectionTools.contains(annotationNamesToKeep, existingAnnotation.getAnnotationName())) { + this.annotations.remove(existingAnnotation); + existingAnnotation.removeAnnotation(); + } + } + if (primaryAnnotationName != null && getAnnotation(primaryAnnotationName) == null) { + newPrimaryAnnotation = buildAnnotation(primaryAnnotationName); + this.annotations.add(newPrimaryAnnotation); + newPrimaryAnnotation.newAnnotation(); + } + // fire collection change event after all annotation changes are done + fireCollectionChanged(ANNOTATIONS_COLLECTION, Collections.unmodifiableCollection(this.annotations)); + return newPrimaryAnnotation; + } + + private boolean annotationIsValid(String annotationName) { + return CollectionTools.contains(this.validAnnotationNames(), annotationName); + } + + abstract Iterator<String> validAnnotationNames(); + + abstract Annotation buildAnnotation(String mappingAnnotationName); + + abstract Annotation buildNullAnnotation(String annotationName); + + // minimize scope of suppressed warnings + @SuppressWarnings("unchecked") + private ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String annotationName) { + return (ContainerAnnotation<NestableAnnotation>) buildAnnotation(annotationName); + } + + @SuppressWarnings("unchecked") + private NestableAnnotation buildNestableAnnotation(String annotationName) { + return (NestableAnnotation) buildAnnotation(annotationName); + } + + // ********** 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(CompilationUnit astRoot) { return this.member.isPersistable(astRoot); } - - public boolean isPersisted() { - return this.getMappingAnnotation() != null; + + public boolean isAnnotated() { + return ! this.annotations.isEmpty(); } - + public boolean isFor(String memberName, int occurrence) { return this.member.matches(memberName, occurrence); } - + public TextRange getTextRange(CompilationUnit astRoot) { return this.fullTextRange(astRoot); } - + private TextRange fullTextRange(CompilationUnit astRoot) { return this.buildTextRange(this.member.getBodyDeclaration(astRoot)); } - + public TextRange getNameTextRange(CompilationUnit astRoot) { return this.member.getNameTextRange(astRoot); } - - + + // ********** update ********** - + public void update(CompilationUnit astRoot) { this.updateAnnotations(astRoot); this.setPersistable(this.buildPersistable(astRoot)); } - + private void updateAnnotations(CompilationUnit astRoot) { - HashSet<Annotation> mappingAnnotationsToRemove = new HashSet<Annotation>(this.mappingAnnotations); - HashSet<Annotation> supportingAnnotationsToRemove = new HashSet<Annotation>(this.supportingAnnotations); - - this.member.getBodyDeclaration(astRoot).accept(this.buildUpdateAnnotationVisitor(astRoot, mappingAnnotationsToRemove, supportingAnnotationsToRemove)); - - for (Annotation annotation : mappingAnnotationsToRemove) { - this.removeItemFromCollection(annotation, this.mappingAnnotations, MAPPING_ANNOTATIONS_COLLECTION); - } - for (Annotation annotation : supportingAnnotationsToRemove) { - this.removeItemFromCollection(annotation, this.supportingAnnotations, SUPPORTING_ANNOTATIONS_COLLECTION); + HashSet<Annotation> annotationsToRemove = + new HashSet<Annotation>(this.annotations); + + this.member.getBodyDeclaration(astRoot).accept( + this.buildUpdateAnnotationVisitor(astRoot, annotationsToRemove)); + + for (Annotation annotation : annotationsToRemove) { + this.removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); } } - - private ASTVisitor buildUpdateAnnotationVisitor(CompilationUnit astRoot, Set<Annotation> mappingAnnotationsToRemove, Set<Annotation> supportingAnnotationsToRemove) { - return new UpdateAnnotationVisitor(astRoot, this.member.getBodyDeclaration(astRoot), mappingAnnotationsToRemove, supportingAnnotationsToRemove); + + private ASTVisitor buildUpdateAnnotationVisitor( + CompilationUnit astRoot, Set<Annotation> annotationsToRemove) { + return new UpdateAnnotationVisitor( + astRoot, this.member.getBodyDeclaration(astRoot), annotationsToRemove); } - - void addOrUpdateAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot, Set<Annotation> mappingAnnotationsToRemove, Set<Annotation> supportingAnnotationsToRemove) { + + void addOrUpdateAnnotation( + org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot, + Set<Annotation> annotationsToRemove) { String jdtAnnotationName = JDTTools.resolveAnnotation(node); if (jdtAnnotationName == null) { return; } - if (this.annotationIsValidSupportingAnnotation(jdtAnnotationName)) { - this.addOrUpdateSupportingAnnotation(jdtAnnotationName, astRoot, supportingAnnotationsToRemove); - return; - } - if (this.annotationIsValidMappingAnnotation(jdtAnnotationName)) { - this.addOrUpdateMappingAnnotation(jdtAnnotationName, astRoot, mappingAnnotationsToRemove); + if (this.annotationIsValid(jdtAnnotationName)) { + this.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove); return; } } - - private void addOrUpdateSupportingAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> supportingAnnotationsToRemove) { - Annotation annotation = this.selectAnnotationNamed(supportingAnnotationsToRemove, jdtAnnotationName); + + private void addOrUpdateAnnotation( + String jdtAnnotationName, CompilationUnit astRoot, + Set<Annotation> annotationsToRemove) { + Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, jdtAnnotationName); if (annotation != null) { annotation.update(astRoot); - supportingAnnotationsToRemove.remove(annotation); - } else { - annotation = this.buildSupportingAnnotation(jdtAnnotationName); - annotation.initialize(astRoot); - this.addItemToCollection(annotation, this.supportingAnnotations, SUPPORTING_ANNOTATIONS_COLLECTION); + annotationsToRemove.remove(annotation); } - } - - private void addOrUpdateMappingAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> mappingAnnotationsToRemove) { - Annotation annotation = this.selectAnnotationNamed(mappingAnnotationsToRemove, jdtAnnotationName); - if (annotation != null) { - annotation.update(astRoot); - mappingAnnotationsToRemove.remove(annotation); - } else { - annotation = this.buildMappingAnnotation(jdtAnnotationName); + else { + annotation = this.buildAnnotation(jdtAnnotationName); annotation.initialize(astRoot); - this.addItemToCollection(annotation, this.mappingAnnotations, MAPPING_ANNOTATIONS_COLLECTION); + this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); } } - - + + // ********** miscellaneous ********** - + public void resolveTypes(CompilationUnit astRoot) { this.setPersistable(this.buildPersistable(astRoot)); } - + private Annotation selectAnnotationNamed(Iterable<Annotation> annotations, String annotationName) { for (Annotation annotation : annotations) { if (annotation.getAnnotationName().equals(annotationName)) { @@ -532,11 +444,11 @@ abstract class SourcePersistentMember<E extends Member> } return null; } - + private TextRange buildTextRange(ASTNode astNode) { return (astNode == null) ? null : new ASTNodeTextRange(astNode); } - + /** * convenience method */ @@ -548,38 +460,40 @@ abstract class SourcePersistentMember<E extends Member> } }; } - - + + // ********** AST visitors ********** - + /** * annotation visitor */ - protected static abstract class AnnotationVisitor extends ASTVisitor { + protected static abstract class AnnotationVisitor + extends ASTVisitor + { protected final CompilationUnit astRoot; protected final BodyDeclaration bodyDeclaration; - + protected AnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration) { super(); this.astRoot = astRoot; this.bodyDeclaration = bodyDeclaration; } - + @Override public boolean visit(SingleMemberAnnotation node) { return visit_(node); } - + @Override public boolean visit(NormalAnnotation node) { return visit_(node); } - + @Override public boolean visit(MarkerAnnotation node) { return visit_(node); } - + protected boolean visit_(org.eclipse.jdt.core.dom.Annotation node) { // ignore annotations for child members, only this member if (node.getParent() == this.bodyDeclaration) { @@ -587,45 +501,47 @@ abstract class SourcePersistentMember<E extends Member> } return false; } - + protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node); - } - + + /** * initial annotation visitor */ - protected class InitialAnnotationVisitor extends AnnotationVisitor { - + protected class InitialAnnotationVisitor + extends AnnotationVisitor + { protected InitialAnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration) { super(astRoot, bodyDeclaration); } - + @Override protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { SourcePersistentMember.this.addInitialAnnotation(node, this.astRoot); } - } - + + /** * update annotation visitor */ - protected class UpdateAnnotationVisitor extends AnnotationVisitor { - protected final Set<Annotation> mappingAnnotationsToRemove; - protected final Set<Annotation> supportingAnnotationsToRemove; - - protected UpdateAnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration, Set<Annotation> mappingAnnotationsToRemove, Set<Annotation> supportingAnnotationsToRemove) { + protected class UpdateAnnotationVisitor + extends AnnotationVisitor + { + protected final Set<Annotation> annotationsToRemove; + + protected UpdateAnnotationVisitor( + CompilationUnit astRoot, BodyDeclaration bodyDeclaration, + Set<Annotation> annotationsToRemove) { super(astRoot, bodyDeclaration); - this.mappingAnnotationsToRemove = mappingAnnotationsToRemove; - this.supportingAnnotationsToRemove = supportingAnnotationsToRemove; + this.annotationsToRemove = annotationsToRemove; } - + @Override protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - SourcePersistentMember.this.addOrUpdateAnnotation(node, this.astRoot, this.mappingAnnotationsToRemove, this.supportingAnnotationsToRemove); - } - + SourcePersistentMember.this.addOrUpdateAnnotation( + node, this.astRoot, this.annotationsToRemove); + } } - } 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 0daad1e8c2..7273060c85 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 @@ -14,9 +14,7 @@ import java.util.HashMap; 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.dom.CompilationUnit; import org.eclipse.jdt.core.dom.FieldDeclaration; import org.eclipse.jdt.core.dom.ITypeBinding; @@ -36,7 +34,6 @@ import org.eclipse.jpt.core.utility.jdt.Type; import org.eclipse.jpt.utility.MethodSignature; import org.eclipse.jpt.utility.internal.Counter; import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.utility.internal.iterators.CloneIterator; import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; import org.eclipse.jpt.utility.internal.iterators.TreeIterator; @@ -160,48 +157,40 @@ final class SourcePersistentType // ********** AbstractJavaResourcePersistentMember implementation ********** - - @Override - Annotation buildMappingAnnotation(String mappingAnnotationName) { - return this.getAnnotationProvider().buildTypeMappingAnnotation(this, this.member, mappingAnnotationName); - } @Override - Annotation buildSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildTypeSupportingAnnotation(this, this.member, annotationName); + Iterator<String> validAnnotationNames() { + return this.getAnnotationProvider().typeAnnotationNames(); } @Override - Annotation buildNullSupportingAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullTypeSupportingAnnotation(this, annotationName); + Annotation buildAnnotation(String mappingAnnotationName) { + return this.getAnnotationProvider(). + buildTypeAnnotation(this, this.member, mappingAnnotationName); } @Override - ListIterator<String> validMappingAnnotationNames() { - return this.getAnnotationProvider().typeMappingAnnotationNames(); - } - - @Override - ListIterator<String> validSupportingAnnotationNames() { - return this.getAnnotationProvider().typeSupportingAnnotationNames(); + Annotation buildNullAnnotation(String annotationName) { + return this.getAnnotationProvider(). + buildNullTypeAnnotation(this, annotationName); } @Override public void resolveTypes(CompilationUnit astRoot) { super.resolveTypes(astRoot); - + this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName(astRoot)); - + for (JavaResourcePersistentAttribute field : this.getFields()) { field.resolveTypes(astRoot); } - + // a new type can trigger a method parameter type to be a resolved, // fully-qualified name, so we need to rebuild our list of methods: // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)" // and, vice-versa, a removed type can "unresolve" a parameter type this.updateMethods(astRoot); - + for (JavaResourcePersistentAttribute method : this.getMethods()) { method.resolveTypes(astRoot); } @@ -209,13 +198,13 @@ final class SourcePersistentType type.resolveTypes(astRoot); } } - + @Override public void toString(StringBuilder sb) { sb.append(this.name); } - - + + // ******** JavaResourcePersistentType implementation ******** // ***** name @@ -311,9 +300,10 @@ final class SourcePersistentType /** * check only persistable attributes */ - public boolean hasAnyAttributePersistenceAnnotations() { - for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) { - if (stream.next().hasAnyPersistenceAnnotations()) { + public boolean hasAnyAnnotatedAttributes() { + for (Iterator<JavaResourcePersistentAttribute> stream = + this.persistableAttributes(); stream.hasNext(); ) { + if (stream.next().isAnnotated()) { return true; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java index 8a41aeab7a..4ab0e88d3d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.core.internal.utility.jdt; import java.lang.reflect.Modifier; import java.util.Iterator; - import org.eclipse.jpt.core.resource.java.AccessType; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; @@ -308,7 +307,7 @@ public class JPTTools { boolean hasPersistableFields = false; for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableFields(); stream.hasNext(); ) { hasPersistableFields = true; - if (stream.next().hasAnyPersistenceAnnotations()) { + if (stream.next().isAnnotated()) { // any field is annotated => FIELD return AccessType.FIELD; } @@ -317,7 +316,7 @@ public class JPTTools { boolean hasPersistableProperties = false; for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableProperties(); stream.hasNext(); ) { hasPersistableProperties = true; - if (stream.next().hasAnyPersistenceAnnotations()) { + if (stream.next().isAnnotated()) { // none of the fields are annotated and a getter is annotated => PROPERTY return AccessType.PROPERTY; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/DerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/DerivedId2_0.java new file mode 100644 index 0000000000..83406099a7 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/DerivedId2_0.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * 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.context; + +import org.eclipse.jpt.core.context.JpaContextNode; + +/** + * 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. + * + * @version 3.0 + * @since 3.0 + */ +public interface DerivedId2_0 + extends JpaContextNode +{ + /** + * String associated with changes to the derived id property of this object + */ + public static final String DERIVED_ID_PROPERTY = "derivedId"; //$NON-NLS-1$ + + /** + * Return whether this object uses a derived id + */ + boolean isDerivedId(); + + /** + * Set whether this object uses a derived id + */ + void setDerivedId(boolean newValue); +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ManyToOneMapping2_0.java new file mode 100644 index 0000000000..a1ff3ce550 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/ManyToOneMapping2_0.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * 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.context; + +import org.eclipse.jpt.core.context.ManyToOneMapping; + +public interface ManyToOneMapping2_0 + extends ManyToOneMapping, SingleRelationshipMapping2_0 +{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OneToOneMapping2_0.java new file mode 100644 index 0000000000..eef30eaed1 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OneToOneMapping2_0.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * 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.context; + +import org.eclipse.jpt.core.context.OneToOneMapping; + +public interface OneToOneMapping2_0 + extends OneToOneMapping, SingleRelationshipMapping2_0 +{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/SingleRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/SingleRelationshipMapping2_0.java new file mode 100644 index 0000000000..3aa991d89d --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/SingleRelationshipMapping2_0.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.context; + +import org.eclipse.jpt.core.context.SingleRelationshipMapping; + +/** + * 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 SingleRelationshipMapping2_0 + extends SingleRelationshipMapping +{ + // **************** Derived id ******************************************** + + DerivedId2_0 getDerivedId(); +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaDerivedId2_0.java new file mode 100644 index 0000000000..6c0db486dd --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaDerivedId2_0.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.context.java.JavaJpaContextNode; +import org.eclipse.jpt.core.jpa2.context.DerivedId2_0; + +/** + * 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 JavaDerivedId2_0 + extends JavaJpaContextNode, DerivedId2_0 +{ + /** + * Initialize model without throwing any events + */ + void initialize(); + + /** + * Update model, throwing events as necessary + */ + void update(); +} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaManyToOneMapping2_0.java new file mode 100644 index 0000000000..e028c94f1e --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaManyToOneMapping2_0.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; + +/** + * 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 JavaManyToOneMapping2_0 + extends JavaManyToOneMapping, JavaSingleRelationshipMapping2_0 +{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOneToOneMapping2_0.java new file mode 100644 index 0000000000..9231347811 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOneToOneMapping2_0.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; + +/** + * 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 JavaOneToOneMapping2_0 + extends JavaOneToOneMapping, JavaSingleRelationshipMapping2_0 +{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java new file mode 100644 index 0000000000..a37ab2ea0b --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.context.java; + +import org.eclipse.jpt.core.context.java.JavaSingleRelationshipMapping; +import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0; + +/** + * 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 JavaSingleRelationshipMapping2_0 + extends JavaSingleRelationshipMapping, SingleRelationshipMapping2_0 +{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/Access2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/Access2_0Annotation.java index 9afb602a4a..0d247d9c1c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/Access2_0Annotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/Access2_0Annotation.java @@ -31,7 +31,7 @@ public interface Access2_0Annotation extends Annotation { - String ANNOTATION_NAME = JPA.ACCESS; + String ANNOTATION_NAME = JPA2_0.ACCESS; /** * Corresponds to the 'value' element of the Access annotation. diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java index 96e65a286c..d16c355f2d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.jpa2.resource.java; /** - * JPA Java-related stuff (annotations etc.) + * JPA 2.0 Java-related stuff (annotations etc.) * * Provisional API: This interface is part of an interim API that is still * under development and expected to change significantly before reaching @@ -19,7 +19,7 @@ package org.eclipse.jpt.core.jpa2.resource.java; * will almost certainly be broken (repeatedly) as the API evolves. */ @SuppressWarnings("nls") -public interface JPA { +public interface JPA2_0 { // JPA package String PACKAGE = "javax.persistence"; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentAttribute.java index 1ede2a0471..386fdd36ed 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentAttribute.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.core.resource.java; import java.util.Iterator; import java.util.ListIterator; - import org.eclipse.jpt.utility.MethodSignature; /** @@ -33,16 +32,16 @@ public interface JavaResourcePersistentAttribute * The Java resource persistent attribute's name does not change. */ String getName(); - + /** - * Return a null mapping annotation with the specified name. + * Return a null annotation for the specified annotation name. * Return null if the specified annotation name is null. * The corresponding AnnotationDefinition must implement #buildNullAnnotation() * {@link AnnotationDefinition#buildNullAnnotation(JavaResourcePersistentMember, * org.eclipse.jpt.core.utility.jdt.Member)} */ - Annotation getNullMappingAnnotation(String annotationName); - + Annotation getNullAnnotation(String annotationName); + /** * Whether the Java resource persistent attribute is a field does not change. */ @@ -54,12 +53,6 @@ public interface JavaResourcePersistentAttribute boolean isProperty(); /** - * Return whether the attribute has any mapping or non-mapping annotations - * (of course only persistence-related annotations). - */ - boolean hasAnyPersistenceAnnotations(); - - /** * Return the access type explicitly specified by the javax.persistence.Access annotation. * Return null if the Access annotation is not present. * For JPA 1.0 this is always going to return null; Access annotation is not supported in 1.0. diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java index 1df750182b..d4a00cf74b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java @@ -10,8 +10,6 @@ package org.eclipse.jpt.core.resource.java; import java.util.Iterator; -import java.util.ListIterator; - import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.utility.TextRange; @@ -27,94 +25,64 @@ import org.eclipse.jpt.core.utility.TextRange; public interface JavaResourcePersistentMember extends JavaResourceNode { - - // ********** mapping annotations ********** - + // ********** annotations ********** + /** - * Return the member's mapping annotations. - * Do not return duplicate annotations as this error is handled by the Java - * compiler. - * @see #supportingAnnotations() + * String associated with changes to the "annotations" collection */ - Iterator<Annotation> mappingAnnotations(); - String MAPPING_ANNOTATIONS_COLLECTION = "mappingAnnotations"; //$NON-NLS-1$ - + String ANNOTATIONS_COLLECTION = "annotations"; //$NON-NLS-1$ + /** - * Return the number of mapping annotations. + * Return the member's annotations in the order that they appear. + * Do not return duplicate annotations as this error is handled by the Java + * compiler. */ - int mappingAnnotationsSize(); - + Iterator<Annotation> annotations(); + /** - * Return the member's mapping annotation. + * Return the number of annotations. */ - Annotation getMappingAnnotation(); - + int annotationsSize(); + /** - * Return the mapping annotation with the specified name. + * Return the annotation with the specified name. * Return the first if there are duplicates in the source code. */ - Annotation getMappingAnnotation(String annotationName); - - /** - * Change the mapping annotation. Remove any other existing mapping - * annotations. Do not remove any supporting (non-mapping) annotations. - */ - Annotation setMappingAnnotation(String annotationName); - - - // ********** supporting annotations ********** - - /** - * Return the member's supporting annotations. - * Do not return duplicate annotations as this error is handled by the Java - * compiler. Do not return any mapping annotations. - * @see #mappingAnnotations() - */ - Iterator<Annotation> supportingAnnotations(); - String SUPPORTING_ANNOTATIONS_COLLECTION = "supportingAnnotations"; //$NON-NLS-1$ - + Annotation getAnnotation(String annotationName); + /** - * Return the number of supporting annotations. + * Return the specified annotation. + * Return the first if there are duplicates in the source code. + * Do not return null, but a Null Object instead if no annotation + * with the specified name exists in the source code. */ - int supportingAnnotationsSize(); - + Annotation getNonNullAnnotation(String annotationName); + /** - * Return the specified supporting nested annotations. - * If both the nestable and container annotations are specified on the + * Return the nestable annotations with the specified name in the order that + * they appear. + * If nestable and container annotations are both specified on the * member directly, return only the nestable annotations specified within * the container annotation. */ // TODO tie the singular and plural annotations together so we can generate // a validation error when both are specified - ListIterator<NestableAnnotation> supportingAnnotations(String nestableAnnotationName, String containerAnnotationName); - - /** - * Return the specified supporting annotation. - * Return the first if there are duplicates in the source code. - */ - Annotation getSupportingAnnotation(String annotationName); - - /** - * Return the specified supporting annotation. - * Return the first if there are duplicates in the source code. - * Do not return null, but a Null Object instead if no annotation - * with the specified name exists in the source code. - */ - Annotation getNonNullSupportingAnnotation(String annotationName); - + Iterator<NestableAnnotation> annotations( + String nestableAnnotationName, String containerAnnotationName); + /** - * Add a supporting annotation with the specified name. + * Add an annotation with the specified name. * Return the newly-created annotation. */ - Annotation addSupportingAnnotation(String annotationName); - + Annotation addAnnotation(String annotationName); + /** - * Add a supporting annotation with the specified name. + * Add an annotation with the specified name. * Initialize the newly-created annotation with the specified annotation initializer. * Return the annotation returned by the annotation initializer. */ - Annotation addSupportingAnnotation(String annotationName, AnnotationInitializer annotationInitializer); - + Annotation addAnnotation(String annotationName, AnnotationInitializer annotationInitializer); + /** * Callback that allows clients to initialize an annotation added to the * member before the member fires a change event. The initializer should @@ -127,14 +95,9 @@ public interface JavaResourcePersistentMember */ Annotation initializeAnnotation(Annotation supportingAnnotation); } - - /** - * Remove the specified supporting annotation. - */ - void removeSupportingAnnotation(String annotationName); - + /** - * Add a new supporting nestable annotation with the specified name. + * Add a new nestable annotation with the specified name. * Create a new container annotation if necessary and add the nestable * annotation to it. * If both the nestable annotation and the container annotation already @@ -145,22 +108,41 @@ public interface JavaResourcePersistentMember * the new one. If neither annotation exists, then create a new nestable * annotation. */ - Annotation addSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName); - + NestableAnnotation addAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName); + /** - * Move the supporting nestable annotation found in the specified container + * Move the nestable annotation found in the specified container * annotation at the specified source index to the specified target index. */ - void moveSupportingAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName); + void moveAnnotation( + int targetIndex, int sourceIndex, String containerAnnotationName); /** - * Remove the specified supporting nestable annotation. + * Remove the specified annotation. */ - void removeSupportingAnnotation(int index, String nestableAnnotationName, String containerAnnotationName); + void removeAnnotation(String annotationName); + + /** + * Remove the specified nestable annotation from the container annotation at the specified + * index. + * If there is no container, assume the index is zero and this does the same as + * {@link #removeAnnotation(String)} + */ + void removeAnnotation( + int index, String nestableAnnotationName, String containerAnnotationName); + + /** + * Sets the specified primary annotation as the first annotation, and removes all known + * annotations (i.e. does not remove non-persistence annotations) which are not included + * in the supporting annotations. + */ + Annotation setPrimaryAnnotation( + String primaryAnnotationName, String[] supportingAnnotationNames); + - // ********** queries ********** - + /** * Return whether the underlying JDT member is persistable according to * the JPA spec. @@ -169,29 +151,28 @@ public interface JavaResourcePersistentMember String PERSISTABLE_PROPERTY = "persistable"; //$NON-NLS-1$ /** - * Return whether the underlying JDT member is currently annotated as being - * persistent (equivalent to "is mapped"). + * Return whether the underlying JDT member is currently annotated with any recognized + * annotations. */ - boolean isPersisted(); - + boolean isAnnotated(); + /** * Return whether the Java resource persistent member is for the specified * member. */ boolean isFor(String memberName, int occurrence); - + /** * Return the text range for the member's name. */ TextRange getNameTextRange(CompilationUnit astRoot); - + // ********** behavior ********** - + /** * Resolve type information that could be dependent on changes elsewhere * in the workspace. */ void resolveTypes(CompilationUnit astRoot); - } 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 3e0089d1bc..408e1650fb 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 @@ -57,7 +57,7 @@ public interface JavaResourcePersistentType * Return whether the type has any attributes that have * JPA annotations on them. */ - boolean hasAnyAttributePersistenceAnnotations(); + boolean hasAnyAnnotatedAttributes(); // ********** types ********** diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java index d556644d62..5fcddec120 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java @@ -40,29 +40,28 @@ public class EclipseLinkJpaAnnotationDefinitionProvider extends AbstractJpaAnnotationDefintionProvider { // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLinkJpaAnnotationDefinitionProvider(); - + private static final JpaAnnotationDefinitionProvider INSTANCE = + new EclipseLinkJpaAnnotationDefinitionProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JpaAnnotationDefinitionProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private EclipseLinkJpaAnnotationDefinitionProvider() { super(); } - @Override - protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - //none - } @Override - protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(EclipseLinkCacheAnnotationDefinition.instance()); definitions.add(EclipseLinkChangeTrackingAnnotationDefinition.instance()); definitions.add(EclipseLinkConverterAnnotationDefinition.instance()); @@ -73,18 +72,11 @@ public class EclipseLinkJpaAnnotationDefinitionProvider definitions.add(EclipseLinkStructConverterAnnotationDefinition.instance()); definitions.add(EclipseLinkTypeConverterAnnotationDefinition.instance()); } - - // 245996 addresses how the attribute mapping annotations should be ordered + @Override - protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { + protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(EclipseLinkBasicCollectionAnnotationDefinition.instance()); definitions.add(EclipseLinkBasicMapAnnotationDefinition.instance()); - definitions.add(EclipseLinkTransformationAnnotationDefinition.instance()); - definitions.add(EclipseLinkVariableOneToOneAnnotationDefinition.instance()); - } - - @Override - protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { definitions.add(EclipseLinkConvertAnnotationDefinition.instance()); definitions.add(EclipseLinkConverterAnnotationDefinition.instance()); definitions.add(EclipseLinkJoinFetchAnnotationDefinition.instance()); @@ -93,7 +85,9 @@ public class EclipseLinkJpaAnnotationDefinitionProvider definitions.add(EclipseLinkPrivateOwnedAnnotationDefinition.instance()); definitions.add(EclipseLinkReadTransformerAnnotationDefinition.instance()); definitions.add(EclipseLinkStructConverterAnnotationDefinition.instance()); + definitions.add(EclipseLinkTransformationAnnotationDefinition.instance()); definitions.add(EclipseLinkTypeConverterAnnotationDefinition.instance()); + definitions.add(EclipseLinkVariableOneToOneAnnotationDefinition.instance()); definitions.add(EclipseLinkWriteTransformerAnnotationDefinition.instance()); } } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java index 5027a842a3..a7e8f1402e 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java @@ -66,7 +66,7 @@ public class JavaEclipseLinkBasicMapping @Override protected String getResourceConverterType() { //check @Convert first, this is the order that EclipseLink searches - if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; } return super.getResourceConverterType(); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java index 13a0eb1d06..226352d220 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java @@ -66,11 +66,13 @@ public class JavaEclipseLinkCachingImpl extends AbstractJavaJpaContextNode imple //You could call more than one setter before this object has received any notification //from the java resource model protected EclipseLinkCacheAnnotation getCacheAnnotation() { - return (EclipseLinkCacheAnnotation) this.resourcePersistentType.getNonNullSupportingAnnotation(getCacheAnnotationName()); + return (EclipseLinkCacheAnnotation) this.resourcePersistentType. + getNonNullAnnotation(getCacheAnnotationName()); } protected EclipseLinkExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getExistenceCheckingAnnotationName()); + return (EclipseLinkExistenceCheckingAnnotation) this.resourcePersistentType. + getAnnotation(getExistenceCheckingAnnotationName()); } protected String getCacheAnnotationName() { @@ -290,10 +292,10 @@ public class JavaEclipseLinkCachingImpl extends AbstractJavaJpaContextNode imple boolean oldExistenceChecking = this.existenceChecking; this.existenceChecking = newExistenceChecking; if (newExistenceChecking) { - this.resourcePersistentType.addSupportingAnnotation(getExistenceCheckingAnnotationName()); + this.resourcePersistentType.addAnnotation(getExistenceCheckingAnnotationName()); } else { - this.resourcePersistentType.removeSupportingAnnotation(getExistenceCheckingAnnotationName()); + this.resourcePersistentType.removeAnnotation(getExistenceCheckingAnnotationName()); } firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, oldExistenceChecking, newExistenceChecking); setDefaultExistenceType(caclulateDefaultExistenceType()); @@ -385,8 +387,8 @@ public class JavaEclipseLinkCachingImpl extends AbstractJavaJpaContextNode imple if (this.expiryTimeOfDay != null) { throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ } - if (this.resourcePersistentType.getSupportingAnnotation(getCacheAnnotationName()) == null) { - this.resourcePersistentType.addSupportingAnnotation(getCacheAnnotationName()); + if (this.resourcePersistentType.getAnnotation(getCacheAnnotationName()) == null) { + this.resourcePersistentType.addAnnotation(getCacheAnnotationName()); } JavaEclipseLinkExpiryTimeOfDay newExpiryTimeOfDay = new JavaEclipseLinkExpiryTimeOfDay(this); this.expiryTimeOfDay = newExpiryTimeOfDay; diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java index fb32ed8f76..1a8428fa99 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java @@ -45,15 +45,15 @@ public class JavaEclipseLinkChangeTracking extends AbstractJavaJpaContextNode im } protected EclipseLinkChangeTrackingAnnotation getChangeTrackingAnnotation() { - return (EclipseLinkChangeTrackingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getChangeTrackingAnnotationName()); + return (EclipseLinkChangeTrackingAnnotation) this.resourcePersistentType.getAnnotation(getChangeTrackingAnnotationName()); } protected void addChangeTrackingAnnotation() { - this.resourcePersistentType.addSupportingAnnotation(getChangeTrackingAnnotationName()); + this.resourcePersistentType.addAnnotation(getChangeTrackingAnnotationName()); } protected void removeChangeTrackingAnnotation() { - this.resourcePersistentType.removeSupportingAnnotation(getChangeTrackingAnnotationName()); + this.resourcePersistentType.removeAnnotation(getChangeTrackingAnnotationName()); } public EclipseLinkChangeTrackingType getType() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java index b5e75d7b8f..cad2f639f2 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java @@ -60,13 +60,13 @@ public class JavaEclipseLinkConvert extends AbstractJavaJpaContextNode implement } public void addToResourceModel() { - this.resourcePersistentAttribute.addSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getAnnotationName()); } public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getAnnotationName()); if (getConverter() != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(getConverter().getAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getConverter().getAnnotationName()); } } @@ -75,7 +75,7 @@ public class JavaEclipseLinkConvert extends AbstractJavaJpaContextNode implement } protected EclipseLinkConvertAnnotation getResourceConvert() { - return (EclipseLinkConvertAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getAnnotationName()); + return (EclipseLinkConvertAnnotation) this.resourcePersistentAttribute.getAnnotation(getAnnotationName()); } public String getConverterName() { @@ -122,11 +122,11 @@ public class JavaEclipseLinkConvert extends AbstractJavaJpaContextNode implement JavaEclipseLinkConverter newConverter = buildConverter(converterType); this.converter = null; if (oldConverter != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(oldConverter.getAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(oldConverter.getAnnotationName()); } this.converter = newConverter; if (newConverter != null) { - this.resourcePersistentAttribute.addSupportingAnnotation(newConverter.getAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(newConverter.getAnnotationName()); } firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); } @@ -205,16 +205,16 @@ public class JavaEclipseLinkConvert extends AbstractJavaJpaContextNode implement } protected String getResourceConverterType() { - if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConverter.CUSTOM_CONVERTER; } - else if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME) != null) { + else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConverter.TYPE_CONVERTER; } - else if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) { + else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; } - else if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME) != null) { + else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConverter.STRUCT_CONVERTER; } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java index 87eda32cfc..85da0c2a56 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java @@ -34,7 +34,7 @@ public abstract class JavaEclipseLinkConverter extends AbstractJavaJpaContextNod protected EclipseLinkNamedConverterAnnotation getAnnotation() { - return (EclipseLinkNamedConverterAnnotation) this.resourcePersistentMember.getSupportingAnnotation(getAnnotationName()); + return (EclipseLinkNamedConverterAnnotation) this.resourcePersistentMember.getAnnotation(getAnnotationName()); } protected abstract String getAnnotationName(); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java index 985aeb2e13..e26c0d7f6d 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java @@ -50,7 +50,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo throw new IllegalStateException("custom converter already exists"); //$NON-NLS-1$ } this.customConverter = buildCustomConverter(); - this.resourcePersistentType.addSupportingAnnotation(this.customConverter.getAnnotationName()); + this.resourcePersistentType.addAnnotation(this.customConverter.getAnnotationName()); firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, null, this.customConverter); return this.customConverter; } @@ -66,7 +66,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } JavaEclipseLinkCustomConverter oldConverter = this.customConverter; this.customConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); + this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, oldConverter, null); } @@ -80,7 +80,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } protected EclipseLinkConverterAnnotation getResourceConverter() { - return (EclipseLinkConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getConverterAnnotationName()); + return (EclipseLinkConverterAnnotation) this.resourcePersistentType.getAnnotation(getConverterAnnotationName()); } @@ -94,7 +94,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo throw new IllegalStateException("object type converter already exists"); //$NON-NLS-1$ } this.objectTypeConverter = buildObjectTypeConverter(); - this.resourcePersistentType.addSupportingAnnotation(this.objectTypeConverter.getAnnotationName()); + this.resourcePersistentType.addAnnotation(this.objectTypeConverter.getAnnotationName()); firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); return this.objectTypeConverter; } @@ -110,7 +110,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } JavaEclipseLinkObjectTypeConverter oldConverter = this.objectTypeConverter; this.objectTypeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); + this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); } @@ -125,7 +125,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } protected EclipseLinkObjectTypeConverterAnnotation getResourceObjectTypeConverter() { - return (EclipseLinkObjectTypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getObjectTypeConverterAnnotationName()); + return (EclipseLinkObjectTypeConverterAnnotation) this.resourcePersistentType.getAnnotation(getObjectTypeConverterAnnotationName()); } @@ -139,7 +139,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo throw new IllegalStateException("type converter already exists"); //$NON-NLS-1$ } this.typeConverter = buildTypeConverter(); - this.resourcePersistentType.addSupportingAnnotation(this.typeConverter.getAnnotationName()); + this.resourcePersistentType.addAnnotation(this.typeConverter.getAnnotationName()); firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); return this.typeConverter; } @@ -155,7 +155,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } JavaEclipseLinkTypeConverter oldConverter = this.typeConverter; this.typeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); + this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); } @@ -170,7 +170,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } protected EclipseLinkTypeConverterAnnotation getResourceTypeConverter() { - return (EclipseLinkTypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getTypeConverterAnnotationName()); + return (EclipseLinkTypeConverterAnnotation) this.resourcePersistentType.getAnnotation(getTypeConverterAnnotationName()); } @@ -184,7 +184,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo throw new IllegalStateException("struct converter already exists"); //$NON-NLS-1$ } this.structConverter = buildStructConverter(); - this.resourcePersistentType.addSupportingAnnotation(this.structConverter.getAnnotationName()); + this.resourcePersistentType.addAnnotation(this.structConverter.getAnnotationName()); firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); return this.structConverter; } @@ -200,7 +200,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } JavaEclipseLinkStructConverter oldConverter = this.structConverter; this.structConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); + this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); } @@ -215,7 +215,7 @@ public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNo } protected EclipseLinkStructConverterAnnotation getResourceStructConverter() { - return (EclipseLinkStructConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getStructConverterAnnotationName()); + return (EclipseLinkStructConverterAnnotation) this.resourcePersistentType.getAnnotation(getStructConverterAnnotationName()); } public void update(JavaResourcePersistentType jrpt) { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java index ee51e446e0..5bf19b59dd 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java @@ -47,11 +47,11 @@ public class JavaEclipseLinkCustomizer extends AbstractJavaJpaContextNode implem } protected void addResourceCustomizer() { - this.resourcePersistentType.addSupportingAnnotation(getAnnotationName()); + this.resourcePersistentType.addAnnotation(getAnnotationName()); } protected void removeResourceCustomizer() { - this.resourcePersistentType.removeSupportingAnnotation(getAnnotationName()); + this.resourcePersistentType.removeAnnotation(getAnnotationName()); } public TextRange getValidationTextRange(CompilationUnit astRoot) { @@ -59,7 +59,7 @@ public class JavaEclipseLinkCustomizer extends AbstractJavaJpaContextNode implem } protected EclipseLinkCustomizerAnnotation getResourceCustomizer() { - return (EclipseLinkCustomizerAnnotation) this.resourcePersistentType.getSupportingAnnotation(getAnnotationName()); + return (EclipseLinkCustomizerAnnotation) this.resourcePersistentType.getAnnotation(getAnnotationName()); } public String getCustomizerClass() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java index f394a24a3c..6b66dee285 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java @@ -66,7 +66,7 @@ public class JavaEclipseLinkIdMapping @Override protected String getResourceConverterType() { //check @Convert first, this is the order that EclipseLink searches - if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; } return super.getResourceConverterType(); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java index 989478e5dd..45aac07dae 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java @@ -37,15 +37,15 @@ public class JavaEclipseLinkJoinFetch } protected EclipseLinkJoinFetchAnnotation getResourceJoinFetch() { - return (EclipseLinkJoinFetchAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getJoinFetchAnnotationName()); + return (EclipseLinkJoinFetchAnnotation) this.resourcePersistentAttribute.getAnnotation(getJoinFetchAnnotationName()); } protected void addResourceJoinFetch() { - this.resourcePersistentAttribute.addSupportingAnnotation(getJoinFetchAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getJoinFetchAnnotationName()); } protected void removeResourceJoinFetch() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getJoinFetchAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getJoinFetchAnnotationName()); } public EclipseLinkJoinFetchType getValue() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java index a1c958abd9..07983c6654 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java @@ -43,15 +43,15 @@ public class JavaEclipseLinkMutable extends AbstractJavaJpaContextNode implement } protected EclipseLinkMutableAnnotation getResourceMutable() { - return (EclipseLinkMutableAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getMutableAnnotationName()); + return (EclipseLinkMutableAnnotation) this.resourcePersistentAttribute.getAnnotation(getMutableAnnotationName()); } protected void addResourceMutable() { - this.resourcePersistentAttribute.addSupportingAnnotation(getMutableAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getMutableAnnotationName()); } protected void removeResourceMutable() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getMutableAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getMutableAnnotationName()); } protected boolean calculateDefaultMutable() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java index 2fe553d365..3baa4c8105 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java @@ -71,15 +71,15 @@ public class JavaEclipseLinkOneToManyMapping } protected EclipseLinkPrivateOwnedAnnotation getResourcePrivateOwned() { - return (EclipseLinkPrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); + return (EclipseLinkPrivateOwnedAnnotation) this.resourcePersistentAttribute.getAnnotation(getPrivateOwnedAnnotationName()); } protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getPrivateOwnedAnnotationName()); } protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getPrivateOwnedAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getPrivateOwnedAnnotationName()); } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingProvider.java index af08f01cab..f503619774 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingProvider.java @@ -53,7 +53,7 @@ public class JavaEclipseLinkOneToManyMappingProvider } @Override - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { String targetEntity = persistentAttribute.getMultiReferenceEntityTypeName(); return (targetEntity != null) && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingProvider.java index 9ab909556f..dcaa388e92 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingProvider.java @@ -53,7 +53,7 @@ public class JavaEclipseLinkOneToOneMappingProvider } @Override - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { String targetEntity = persistentAttribute.getSingleReferenceEntityTypeName(); return (targetEntity != null) && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java index 281cdfd505..b78910b26b 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java @@ -17,7 +17,9 @@ import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; -public class JavaEclipseLinkPrivateOwned extends AbstractJavaJpaContextNode implements EclipseLinkPrivateOwned +public class JavaEclipseLinkPrivateOwned + extends AbstractJavaJpaContextNode + implements EclipseLinkPrivateOwned { protected boolean privateOwned; @@ -32,15 +34,15 @@ public class JavaEclipseLinkPrivateOwned extends AbstractJavaJpaContextNode impl } protected EclipseLinkPrivateOwnedAnnotation getResourcePrivateOwned() { - return (EclipseLinkPrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); + return (EclipseLinkPrivateOwnedAnnotation) this.resourcePersistentAttribute.getAnnotation(getPrivateOwnedAnnotationName()); } protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); + this.resourcePersistentAttribute.addAnnotation(getPrivateOwnedAnnotationName()); } protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getPrivateOwnedAnnotationName()); + this.resourcePersistentAttribute.removeAnnotation(getPrivateOwnedAnnotationName()); } public boolean isPrivateOwned() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java index 87acff8b97..6c68a9c0a0 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java @@ -34,15 +34,15 @@ public class JavaEclipseLinkReadOnly extends AbstractJavaJpaContextNode implemen } protected EclipseLinkReadOnlyAnnotation getResourceReadOnly() { - return (EclipseLinkReadOnlyAnnotation) this.resourcePersistentType.getSupportingAnnotation(getReadOnlyAnnotationName()); + return (EclipseLinkReadOnlyAnnotation) this.resourcePersistentType.getAnnotation(getReadOnlyAnnotationName()); } protected void addResourceReadOnly() { - this.resourcePersistentType.addSupportingAnnotation(getReadOnlyAnnotationName()); + this.resourcePersistentType.addAnnotation(getReadOnlyAnnotationName()); } protected void removeResourceReadOnly() { - this.resourcePersistentType.removeSupportingAnnotation(getReadOnlyAnnotationName()); + this.resourcePersistentType.removeAnnotation(getReadOnlyAnnotationName()); } public boolean isReadOnly() { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingProvider.java index efeb4a0d12..0670f1a268 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingProvider.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingProvider.java @@ -55,7 +55,7 @@ public class JavaEclipseLinkVariableOneToOneMappingProvider } @Override - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + public boolean testDefault(JavaPersistentAttribute persistentAttribute) { return ((JavaEclipseLinkPersistentAttribute) persistentAttribute).typeIsValidForVariableOneToOne(); } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java index dbfe1e38d4..5a439f9272 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java @@ -66,7 +66,7 @@ public class JavaEclipseLinkVersionMapping @Override protected String getResourceConverterType() { //check @Convert first, this is the order that EclipseLink searches - if (this.resourcePersistentAttribute.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { + if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; } return super.getResourceConverterType(); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java index e180abe98d..de2eb61fee 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java @@ -35,8 +35,8 @@ public class NullEclipseLinkCacheAnnotation } @Override - protected EclipseLinkCacheAnnotation addSupportingAnnotation() { - return (EclipseLinkCacheAnnotation) super.addSupportingAnnotation(); + protected EclipseLinkCacheAnnotation addAnnotation() { + return (EclipseLinkCacheAnnotation) super.addAnnotation(); } // ***** type @@ -46,7 +46,7 @@ public class NullEclipseLinkCacheAnnotation public void setType(CacheType type) { if (type != null) { - this.addSupportingAnnotation().setType(type); + this.addAnnotation().setType(type); } } @@ -61,7 +61,7 @@ public class NullEclipseLinkCacheAnnotation public void setSize(Integer size) { if (size != null) { - this.addSupportingAnnotation().setSize(size); + this.addAnnotation().setSize(size); } } @@ -76,7 +76,7 @@ public class NullEclipseLinkCacheAnnotation public void setShared(Boolean shared) { if (shared != null) { - this.addSupportingAnnotation().setShared(shared); + this.addAnnotation().setShared(shared); } } @@ -91,7 +91,7 @@ public class NullEclipseLinkCacheAnnotation public void setExpiry(Integer expiry) { if (expiry != null) { - this.addSupportingAnnotation().setExpiry(expiry); + this.addAnnotation().setExpiry(expiry); } } @@ -105,7 +105,7 @@ public class NullEclipseLinkCacheAnnotation } public EclipseLinkTimeOfDayAnnotation addExpiryTimeOfDay() { - return this.addSupportingAnnotation().addExpiryTimeOfDay(); + return this.addAnnotation().addExpiryTimeOfDay(); } public void removeExpiryTimeOfDay() { @@ -123,7 +123,7 @@ public class NullEclipseLinkCacheAnnotation public void setAlwaysRefresh(Boolean alwaysRefresh) { if (alwaysRefresh != null) { - this.addSupportingAnnotation().setAlwaysRefresh(alwaysRefresh); + this.addAnnotation().setAlwaysRefresh(alwaysRefresh); } } @@ -138,7 +138,7 @@ public class NullEclipseLinkCacheAnnotation public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { if (refreshOnlyIfNewer != null) { - this.addSupportingAnnotation().setRefreshOnlyIfNewer(refreshOnlyIfNewer); + this.addAnnotation().setRefreshOnlyIfNewer(refreshOnlyIfNewer); } } @@ -153,7 +153,7 @@ public class NullEclipseLinkCacheAnnotation public void setDisableHits(Boolean disableHits) { if (disableHits != null) { - this.addSupportingAnnotation().setDisableHits(disableHits); + this.addAnnotation().setDisableHits(disableHits); } } @@ -168,7 +168,7 @@ public class NullEclipseLinkCacheAnnotation public void setCoordinationType(CacheCoordinationType coordinationType) { if (coordinationType != null) { - this.addSupportingAnnotation().setCoordinationType(coordinationType); + this.addAnnotation().setCoordinationType(coordinationType); } } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java index 96204df461..a54e42a3d5 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java @@ -32,8 +32,8 @@ public class NullEclipseLinkJoinFetchAnnotation } @Override - protected EclipseLinkJoinFetchAnnotation addSupportingAnnotation() { - return (EclipseLinkJoinFetchAnnotation) super.addSupportingAnnotation(); + protected EclipseLinkJoinFetchAnnotation addAnnotation() { + return (EclipseLinkJoinFetchAnnotation) super.addAnnotation(); } // ***** value @@ -43,7 +43,7 @@ public class NullEclipseLinkJoinFetchAnnotation public void setValue(JoinFetchType value) { if (value != null) { - this.addSupportingAnnotation().setValue(value); + this.addAnnotation().setValue(value); } } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java index e7b56c525c..f08f045eb8 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java @@ -32,8 +32,8 @@ public class NullEclipseLinkTransformationAnnotation } @Override - protected EclipseLinkTransformationAnnotation setMappingAnnotation() { - return (EclipseLinkTransformationAnnotation) super.setMappingAnnotation(); + protected EclipseLinkTransformationAnnotation addAnnotation() { + return (EclipseLinkTransformationAnnotation) super.addAnnotation(); } // ***** fetch @@ -43,7 +43,7 @@ public class NullEclipseLinkTransformationAnnotation public void setFetch(FetchType fetch) { if (fetch != null) { - this.setMappingAnnotation().setFetch(fetch); + this.addAnnotation().setFetch(fetch); } } @@ -58,7 +58,7 @@ public class NullEclipseLinkTransformationAnnotation public void setOptional(Boolean optional) { if (optional != null) { - this.setMappingAnnotation().setOptional(optional); + this.addAnnotation().setOptional(optional); } } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkVariableOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkVariableOneToOneAnnotation.java index 151bc3c87a..3a3fe83e65 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkVariableOneToOneAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkVariableOneToOneAnnotation.java @@ -29,8 +29,8 @@ public class NullEclipseLinkVariableOneToOneAnnotation } @Override - protected EclipseLinkVariableOneToOneAnnotation setMappingAnnotation() { - return (EclipseLinkVariableOneToOneAnnotation) super.setMappingAnnotation(); + protected EclipseLinkVariableOneToOneAnnotation addAnnotation() { + return (EclipseLinkVariableOneToOneAnnotation) super.addAnnotation(); } } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java index 57c11f9650..c35e60ca8e 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java @@ -31,5 +31,4 @@ public class NullEclipseLinkWriteTransformerColumnAnnotation protected ColumnAnnotation addAnnotation() { return this.getWriteTransformerAnnotation().addColumn(); } - } diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java index d0f2d4e858..a5413be9a9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java +++ b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java @@ -32,7 +32,7 @@ public class JavaTestTypeMapping extends AbstractJavaTypeMapping return TEST_TYPE_MAPPING_KEY; } - public Iterator<String> correspondingAnnotationNames() { + public Iterator<String> supportingAnnotationNames() { return EmptyIterator.instance(); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java index 4eb6560a3d..86d3a26ea9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java +++ b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMappingProvider.java @@ -12,30 +12,32 @@ package org.eclipse.jpt.core.tests.extension.resource; import org.eclipse.jpt.core.JpaFactory; import org.eclipse.jpt.core.context.java.JavaPersistentType; import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; +import org.eclipse.jpt.core.internal.context.java.AbstractJavaTypeMappingProvider; -/** - * - */ public class JavaTestTypeMappingProvider - implements JavaTypeMappingProvider + extends AbstractJavaTypeMappingProvider { // singleton - private static final JavaTestTypeMappingProvider INSTANCE = new JavaTestTypeMappingProvider(); - + private static final JavaTestTypeMappingProvider INSTANCE = + new JavaTestTypeMappingProvider(); + + /** - * Return the singleton. + * Return the singleton */ public static JavaTypeMappingProvider instance() { return INSTANCE; } - + + /** - * Ensure single instance. + * Enforce singleton usage */ private JavaTestTypeMappingProvider() { super(); } - + + public String getKey() { return JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY; } @@ -47,5 +49,4 @@ public class JavaTestTypeMappingProvider public JavaTestTypeMapping buildMapping(JavaPersistentType parent, JpaFactory factory) { return ((TestJpaFactory) factory).buildJavaTestTypeMapping(parent); } - } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java index 0b1d6092be..1eb04af10c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java @@ -145,8 +145,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof EmbeddedAnnotation); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey()); assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping); @@ -163,8 +162,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof EmbeddedAnnotation); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey()); assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping); @@ -181,8 +179,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation()); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); assertNull(persistentAttribute.getSpecifiedMapping()); } @@ -196,8 +193,8 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.setMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME); - + attributeResource.setPrimaryAnnotation(EmbeddedAnnotation.ANNOTATION_NAME, new String[0]); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey()); } @@ -210,7 +207,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.setMappingAnnotation(BasicAnnotation.ANNOTATION_NAME); + attributeResource.setPrimaryAnnotation(BasicAnnotation.ANNOTATION_NAME, new String[0]); assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java index 65484b8879..ab2dc13a4c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java @@ -558,8 +558,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getMappingAnnotation()); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); + assertNotNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -573,8 +572,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getMappingAnnotation()); - assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation); + assertNotNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -588,8 +586,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation()); - assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -601,7 +598,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); + typeResource.setPrimaryAnnotation(EmbeddableAnnotation.ANNOTATION_NAME, new String[0]); assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -613,7 +610,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(EntityAnnotation.ANNOTATION_NAME); + typeResource.setPrimaryAnnotation(EntityAnnotation.ANNOTATION_NAME, new String[0]); assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java index d175df20c4..864cc5c23f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java @@ -104,7 +104,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase javaAssociationOverride = javaAssociationOverride.setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("address", javaAssociationOverride.getName()); assertEquals("address", associationOverrideResource.getName()); @@ -124,9 +124,9 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase assertEquals("FOO", javaAssociationOverride.getName()); assertEquals("FOO", associationOverrideResource.getName()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertFalse(getJavaEntity().specifiedAssociationOverrides().hasNext()); - assertFalse(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext()); + assertFalse(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext()); } public void testModifyName() throws Exception { @@ -140,7 +140,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase javaAssociationOverride = javaAssociationOverride.setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("address", javaAssociationOverride.getName()); assertEquals("address", associationOverrideResource.getName()); @@ -154,7 +154,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase //set name to null in the context model javaAssociationOverride.setName(null); assertNull(javaAssociationOverride.getName()); - associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNull(associationOverrideResource.getName()); } @@ -170,7 +170,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase JavaJoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JavaJoinColumn joinColumn = joiningStrategy.addSpecifiedJoinColumn(0); @@ -214,7 +214,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase JoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(1, associationOverrideResource.joinColumnsSize()); @@ -252,7 +252,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase JavaJoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); joiningStrategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); joiningStrategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -295,7 +295,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase JavaJoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.specifiedJoinColumns(); JoinColumn joinColumn = joinColumns.next(); @@ -364,7 +364,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverrideResource.setName("FOO"); specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next(); @@ -381,7 +381,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase specifiedAssociationOverride.setName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("FOO", associationOverrideResource.getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java index 7edb9406a7..1f4d501c2c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java @@ -90,7 +90,7 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); attributeOverrideResource.setName("FOO"); specifiedAttributeOverride = getJavaEntity().specifiedAttributeOverrides().next(); @@ -107,7 +107,7 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase specifiedAttributeOverride.setName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals("FOO", attributeOverrideResource.getName()); } @@ -122,7 +122,7 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation columnResource = attributeOverrideResource.getColumn(); columnResource.setName("FOO"); @@ -141,14 +141,14 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase column.setSpecifiedName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation columnResource = attributeOverrideResource.getColumn(); assertEquals("FOO", columnResource.getName()); column.setSpecifiedName(null); - attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertNull(attributeOverrideResource.getColumn()); assertNotNull(specifiedAttributeOverride.getColumn()); } @@ -238,7 +238,7 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals("FOO", attributeOverrideResource.getColumn().getName()); assertEquals("FOO", entity.specifiedAttributeOverrides().next().getColumn().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java index 6847910211..646ea24cb6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; - import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jpt.core.JptCorePlugin; import org.eclipse.jpt.core.MappingKeys; @@ -205,7 +204,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); basic.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch()); @@ -233,12 +232,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch()); basicMapping.setSpecifiedFetch(null); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); } public void testSetSpecifiedFetch2() throws Exception { @@ -256,7 +255,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch()); @@ -265,7 +264,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertFalse(basicMapping.isDefault()); basicMapping.setSpecifiedFetch(null); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); @@ -278,7 +277,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase getPersistenceXmlResource().save(null); } - public void testSetBasicRemovedFromResourceModel() throws Exception { + public void testSetBasicToDefault() throws Exception { createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); @@ -286,26 +285,28 @@ public class JavaBasicMappingTests extends ContextModelTestCase BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); + assertFalse(basicMapping.isDefault()); + basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + assertFalse(basicMapping.isDefault()); - attributeResource.setMappingAnnotation(null); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNotSame(basicMapping, persistentAttribute.getMapping()); basicMapping = (BasicMapping) persistentAttribute.getMapping(); + assertTrue(basicMapping.isDefault()); assertEquals("FOO", basicMapping.getColumn().getSpecifiedName()); - - - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToDefaultBasic() throws Exception { @@ -320,8 +321,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setSpecifiedConverter(Converter.ENUMERATED_CONVERTER); ((EnumeratedConverter) basicMapping.getSpecifiedConverter()).setSpecifiedEnumType(EnumType.STRING); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -332,11 +333,11 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToId() throws Exception { @@ -351,8 +352,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER); ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -361,12 +362,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType()); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToVersion() throws Exception { @@ -381,20 +382,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setSpecifiedConverter(Converter.TEMPORAL_CONVERTER); ((TemporalConverter) basicMapping.getSpecifiedConverter()).setTemporalType(TemporalType.TIME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertFalse(basicMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getSpecifiedConverter()).getTemporalType()); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToEmbedded() throws Exception { @@ -407,20 +408,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertFalse(basicMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToEmbeddedId() throws Exception { @@ -433,20 +434,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertFalse(basicMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToTransient() throws Exception { @@ -459,20 +460,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertFalse(basicMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToOneToOne() throws Exception { @@ -485,9 +486,9 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -497,12 +498,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase //TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToOneToMany() throws Exception { @@ -515,9 +516,9 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -527,11 +528,11 @@ public class JavaBasicMappingTests extends ContextModelTestCase //TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToManyToOne() throws Exception { createTestEntityWithBasicMapping(); @@ -543,9 +544,9 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -555,12 +556,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase //TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testBasicMorphToManyToMany() throws Exception { @@ -573,9 +574,9 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); - attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); basicMapping.setSpecifiedFetch(FetchType.EAGER); basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); @@ -585,11 +586,11 @@ public class JavaBasicMappingTests extends ContextModelTestCase //TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testDefaultBasicGetDefaultOptional() throws Exception { @@ -635,7 +636,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); basic.setOptional(Boolean.FALSE); assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional()); @@ -663,12 +664,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.FALSE, basic.getOptional()); basicMapping.setSpecifiedOptional(null); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); } public void testSetSpecifiedOptional2() throws Exception { @@ -684,7 +685,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); @@ -693,7 +694,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertFalse(basicMapping.isDefault()); basicMapping.setSpecifiedOptional(null); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); @@ -712,7 +713,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); basic.setOptional(Boolean.FALSE); assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional()); @@ -723,7 +724,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertSame(basicMapping, persistentAttribute.getSpecifiedMapping()); basic.setOptional(Boolean.FALSE); - attributeResource.setMappingAnnotation(null); + attributeResource.setPrimaryAnnotation(null, new String[0]); assertNull(persistentAttribute.getSpecifiedMapping()); assertEquals(true, ((BasicMapping) persistentAttribute.getMapping()).isOptional()); @@ -761,10 +762,10 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); basicMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(LobAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME)); } public void testIsLobUpdatesFromResourceModelChange() throws Exception { @@ -778,11 +779,11 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME); assertTrue(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER); - attributeResource.removeSupportingAnnotation(LobAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(LobAnnotation.ANNOTATION_NAME); assertFalse(basicMapping.getConverter().getType() == Converter.LOB_CONVERTER); } @@ -816,7 +817,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) basicMapping.getConverter()).getDefaultEnumType()); enumeratedAnnotation.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING); @@ -845,7 +846,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); assertNotNull(enumerated); assertEquals(null, enumerated.getValue()); @@ -854,11 +855,11 @@ public class JavaBasicMappingTests extends ContextModelTestCase assertEquals(org.eclipse.jpt.core.resource.java.EnumType.STRING, enumerated.getValue()); ((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(null); - assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); assertNull(enumerated.getValue()); basicMapping.setSpecifiedConverter(Converter.NO_CONVERTER); - assertNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); } public void testGetSpecifiedEnumeratedUpdatesFromResourceModelChange() throws Exception { @@ -873,13 +874,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.addSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME); enumerated.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING); assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType()); enumerated.setValue(null); - assertNotNull(attributeResource.getSupportingAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME)); assertNull(((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType()); assertFalse(basicMapping.isDefault()); assertSame(basicMapping, persistentAttribute.getSpecifiedMapping()); @@ -891,7 +892,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next(); BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); @@ -923,12 +924,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); basicMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetTemporalUpdatesFromResourceModelChange() throws Exception { @@ -943,13 +944,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(Converter.TEMPORAL_CONVERTER, basicMapping.getConverter().getType()); assertEquals(TemporalType.DATE, ((TemporalConverter) basicMapping.getConverter()).getTemporalType()); - attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType()); assertFalse(basicMapping.isDefault()); @@ -968,7 +969,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java index 057325483f..8edb76390d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java @@ -168,7 +168,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("foo", column.getName()); } @@ -185,7 +185,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); } public void testGetNameUpdatesFromResourceChange() throws Exception { @@ -197,7 +197,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedName()); @@ -276,7 +276,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("foo", column.getTable()); } @@ -293,7 +293,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); } public void testGetTableUpdatesFromResourceChange() throws Exception { @@ -305,7 +305,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setTable("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedTable()); @@ -332,7 +332,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("foo", column.getColumnDefinition()); @@ -349,7 +349,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setColumnDefinition("foo"); assertEquals("foo", basicMapping.getColumn().getColumnDefinition()); @@ -391,7 +391,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setLength(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedLength()); @@ -399,7 +399,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setLength(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedLength()); } @@ -415,7 +415,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getLength()); @@ -456,7 +456,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setPrecision(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedPrecision()); @@ -464,7 +464,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setPrecision(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedPrecision()); } @@ -480,7 +480,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getPrecision()); @@ -521,7 +521,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setScale(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedScale()); @@ -529,7 +529,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setScale(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedScale()); } @@ -545,7 +545,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getScale()); @@ -586,7 +586,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setUnique(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUnique()); @@ -594,7 +594,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setUnique(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedUnique()); } @@ -610,7 +610,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getUnique()); @@ -651,7 +651,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setInsertable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedInsertable()); @@ -659,7 +659,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setInsertable(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedInsertable()); } @@ -675,7 +675,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getInsertable()); @@ -716,7 +716,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setNullable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedNullable()); @@ -724,7 +724,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setNullable(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedNullable()); } @@ -740,7 +740,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getNullable()); @@ -781,7 +781,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setUpdatable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUpdatable()); @@ -789,7 +789,7 @@ public class JavaColumnTests extends ContextModelTestCase column.setUpdatable(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.COLUMN)); assertNull(basicMapping.getColumn().getSpecifiedUpdatable()); } @@ -805,7 +805,7 @@ public class JavaColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java index 9abd19c687..a007aee983 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java @@ -164,7 +164,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertEquals("foo", getJavaEntity().getDiscriminatorColumn().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals("foo", discriminatorColumn.getName()); } @@ -178,7 +178,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNull(discriminatorColumn); } @@ -217,7 +217,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR); assertEquals(DiscriminatorType.CHAR, getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); @@ -232,13 +232,13 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType()); getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null); getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(null); - assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN)); + assertNull(typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN)); } public void testGetDiscriminatorTypeUpdatesFromResourceChange() throws Exception { @@ -248,7 +248,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.INTEGER); assertEquals(DiscriminatorType.INTEGER, getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); @@ -299,7 +299,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); discriminatorColumn.setLength(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), getJavaEntity().getDiscriminatorColumn().getSpecifiedLength()); @@ -307,7 +307,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase discriminatorColumn.setName(null); discriminatorColumn.setLength(null); - assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN)); + assertNull(typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN)); assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength()); } @@ -320,13 +320,13 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(100)); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(Integer.valueOf(100), discriminatorColumn.getLength()); getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null); getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(null); - assertNull(typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN)); + assertNull(typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN)); } public void testGetLengthUpdatesFromResourceChange() throws Exception { @@ -336,7 +336,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setLength(Integer.valueOf(78)); assertEquals(Integer.valueOf(78), getJavaEntity().getDiscriminatorColumn().getSpecifiedLength()); @@ -359,7 +359,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setColumnDefinition(COLUMN_DEFINITION); assertEquals(COLUMN_DEFINITION, getJavaEntity().getDiscriminatorColumn().getColumnDefinition()); @@ -368,7 +368,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition()); - typeResource.removeSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN); } public void testSetColumnDefinition() throws Exception { @@ -378,12 +378,12 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase getJavaEntity().getDiscriminatorColumn().setColumnDefinition("foo"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals("foo", column.getColumnDefinition()); getJavaEntity().getDiscriminatorColumn().setColumnDefinition(null); - column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNull(column.getColumnDefinition()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java index 176178bb91..796dffa632 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java @@ -51,7 +51,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof Entity); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testMorphToMappedSuperclass() throws Exception { @@ -62,7 +62,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testMorphToNull() throws Exception { @@ -73,7 +73,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testEmbeddable() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java index 22da3d88d4..49be5b1e16 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java @@ -115,16 +115,16 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -137,15 +137,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); assertTrue(persistentAttribute.getMapping().isDefault()); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testDefaultEmbeddedIdMapping() throws Exception { @@ -175,15 +175,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -195,15 +195,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -215,15 +215,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof IdMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -235,15 +235,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -255,15 +255,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -275,15 +275,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -295,15 +295,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -315,15 +315,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedIdMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testSpecifiedAttributeOverrides() throws Exception { @@ -342,13 +342,13 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -356,7 +356,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -365,26 +365,26 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - attributeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); } @@ -400,8 +400,8 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertEquals("myEmbeddedId", attributeResource.getName()); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.virtualAttributeOverridesSize()); AttributeOverride defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next(); @@ -435,8 +435,8 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7)); assertEquals("myEmbeddedId", attributeResource.getName()); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.virtualAttributeOverridesSize()); defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next(); @@ -475,7 +475,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertEquals(0, defaultAttributeOverride.getColumn().getPrecision()); assertEquals(0, defaultAttributeOverride.getColumn().getScale()); - AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); annotation.setName("city"); assertEquals(1, embeddedMapping.virtualAttributeOverridesSize()); } @@ -493,9 +493,9 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, embeddedIdMapping.specifiedAttributeOverridesSize()); @@ -514,14 +514,14 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(4, embeddedIdMapping.attributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(4, embeddedIdMapping.attributeOverridesSize()); } @@ -539,16 +539,16 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertEquals(2, embeddedIdMapping.virtualAttributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(1, embeddedIdMapping.virtualAttributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("state"); assertEquals(0, embeddedIdMapping.virtualAttributeOverridesSize()); } @@ -565,14 +565,14 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); embeddedIdMapping.specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); @@ -580,7 +580,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertEquals(1, embeddedIdMapping.virtualAttributeOverridesSize()); embeddedIdMapping.specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertFalse(attributeOverrides.hasNext()); Iterator<AttributeOverride> virtualAttributeOverrides = embeddedIdMapping.virtualAttributeOverrides(); @@ -603,7 +603,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -624,9 +624,9 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.moveSupportingAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java index b6d0b47c3d..3ba811aae2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java @@ -121,9 +121,9 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -136,15 +136,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); assertTrue(persistentAttribute.getMapping().isDefault()); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testDefaultEmbeddedMapping() throws Exception { @@ -221,15 +221,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -241,15 +241,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -261,15 +261,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof IdMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -281,15 +281,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -301,15 +301,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -321,15 +321,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -341,15 +341,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -361,15 +361,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertFalse(embeddedMapping.isDefault()); persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - assertNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testSpecifiedAttributeOverrides() throws Exception { @@ -388,13 +388,13 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -402,7 +402,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -411,26 +411,26 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - attributeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); } @@ -446,8 +446,8 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertEquals("myEmbedded", attributeResource.getName()); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.virtualAttributeOverridesSize()); AttributeOverride defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next(); @@ -481,8 +481,8 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7)); assertEquals("myEmbedded", attributeResource.getName()); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.virtualAttributeOverridesSize()); defaultAttributeOverride = embeddedMapping.virtualAttributeOverrides().next(); @@ -521,7 +521,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertEquals(0, defaultAttributeOverride.getColumn().getPrecision()); assertEquals(0, defaultAttributeOverride.getColumn().getScale()); - AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); annotation.setName("city"); assertEquals(1, embeddedMapping.virtualAttributeOverridesSize()); } @@ -539,9 +539,9 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, embeddedMapping.specifiedAttributeOverridesSize()); @@ -560,14 +560,14 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(4, embeddedMapping.attributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(4, embeddedMapping.attributeOverridesSize()); } @@ -585,16 +585,16 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertEquals(2, embeddedMapping.virtualAttributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(1, embeddedMapping.virtualAttributeOverridesSize()); - attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("state"); assertEquals(0, embeddedMapping.virtualAttributeOverridesSize()); } @@ -611,14 +611,14 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); embeddedMapping.specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); @@ -626,7 +626,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertEquals(1, embeddedMapping.virtualAttributeOverridesSize()); embeddedMapping.specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertFalse(attributeOverrides.hasNext()); Iterator<AttributeOverride> virtualAttributeOverrides = embeddedMapping.virtualAttributeOverrides(); @@ -649,7 +649,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -669,9 +669,9 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.moveSupportingAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); - Iterator<NestableAnnotation> attributeOverrides = attributeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java index 9ba9a0328f..bed199e186 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java @@ -361,8 +361,8 @@ public class JavaEntityTests extends ContextModelTestCase entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); - typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); entity.setSpecifiedDiscriminatorValue("asdf"); entity.getDiscriminatorColumn().setSpecifiedName("BAR"); @@ -375,20 +375,20 @@ public class JavaEntityTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass); - assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddable() throws Exception { @@ -400,8 +400,8 @@ public class JavaEntityTests extends ContextModelTestCase entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); - typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); entity.setSpecifiedDiscriminatorValue("asdf"); entity.getDiscriminatorColumn().setSpecifiedName("BAR"); @@ -414,20 +414,20 @@ public class JavaEntityTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable); - assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testMorphToNull() throws Exception { @@ -439,8 +439,8 @@ public class JavaEntityTests extends ContextModelTestCase entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); - typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); entity.setSpecifiedDiscriminatorValue("asdf"); entity.getDiscriminatorColumn().setSpecifiedName("BAR"); @@ -453,20 +453,20 @@ public class JavaEntityTests extends ContextModelTestCase getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping); - assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testAccessNoAnnotations() throws Exception { @@ -492,7 +492,8 @@ public class JavaEntityTests extends ContextModelTestCase ((IdMapping) parentPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.persistableProperties().next().setMappingAnnotation(null); + + typeResource.persistableProperties().next().removeAnnotation(JPA.ID); //no mapping(Id) annotation, but still a Column annotation, so access should still be property assertEquals(AccessType.PROPERTY, parentPersistentType.getAccess()); assertEquals(AccessType.PROPERTY, childPersistentType.getAccess()); @@ -534,10 +535,11 @@ public class JavaEntityTests extends ContextModelTestCase ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.persistableProperties().next().setMappingAnnotation(null); + + typeResource.persistableProperties().next().removeAnnotation(JPA.ID); //no mapping(Id) annotation, but still a Column annotation, so access should still be property assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess()); - + ((BasicMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName(null); assertEquals(AccessType.FIELD, getJavaPersistentType().getAccess()); @@ -611,7 +613,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertEquals("foo", ((EntityAnnotation) typeResource.getMappingAnnotation()).getName()); + assertEquals("foo", ((EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName()); } public void testSetSpecifiedNameNull() throws Exception { @@ -624,7 +626,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(((EntityAnnotation) typeResource.getMappingAnnotation()).getName()); + assertNull(((EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName()); } public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception { @@ -632,7 +634,7 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME); entity.setName("foo"); assertEquals("foo", getJavaEntity().getSpecifiedName()); @@ -713,7 +715,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(InheritanceType.TABLE_PER_CLASS, getJavaEntity().getSpecifiedInheritanceStrategy()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME); inheritance.setStrategy(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED); @@ -734,7 +736,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(InheritanceType.JOINED, getJavaEntity().getSpecifiedInheritanceStrategy()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(InheritanceAnnotation.ANNOTATION_NAME); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED, inheritance.getStrategy()); } @@ -768,7 +770,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(DISCRIMINATOR_VALUE, getJavaEntity().getSpecifiedDiscriminatorValue()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); discriminatorValue.setValue("foo"); @@ -777,7 +779,7 @@ public class JavaEntityTests extends ContextModelTestCase discriminatorValue.setValue(null); assertNull(getJavaEntity().getSpecifiedDiscriminatorValue()); - assertNull(typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME)); } public void testSetSpecifiedDiscriminatorValue() throws Exception { @@ -790,7 +792,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("foo", getJavaEntity().getSpecifiedDiscriminatorValue()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); assertEquals("foo", discriminatorValue.getValue()); } @@ -814,9 +816,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.secondaryTablesSize()); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.secondaryTablesSize()); } @@ -842,9 +844,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.specifiedSecondaryTablesSize()); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.specifiedSecondaryTablesSize()); } @@ -858,7 +860,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); @@ -875,7 +877,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); @@ -925,11 +927,11 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME))); getJavaEntity().removeSpecifiedSecondaryTable(1); - Iterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); assertFalse(secondaryTableResources.hasNext()); @@ -941,7 +943,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().removeSpecifiedSecondaryTable(1); - secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); assertFalse(secondaryTableResources.hasNext()); @@ -951,12 +953,12 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().removeSpecifiedSecondaryTable(0); - secondaryTableResources = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertFalse(secondaryTableResources.hasNext()); secondaryTables = getJavaEntity().secondaryTables(); assertFalse(secondaryTables.hasNext()); - assertNull(typeResource.getSupportingAnnotation(SecondaryTablesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(SecondaryTablesAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedSecondaryTable() throws Exception { @@ -970,7 +972,7 @@ public class JavaEntityTests extends ContextModelTestCase entity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); entity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ"); - ListIterator<NestableAnnotation> javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaSecondaryTables)); @@ -980,7 +982,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", secondaryTables.next().getSpecifiedName()); assertEquals("FOO", secondaryTables.next().getSpecifiedName()); - javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); assertEquals("BAZ", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); assertEquals("FOO", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); @@ -992,7 +994,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", secondaryTables.next().getSpecifiedName()); assertEquals("FOO", secondaryTables.next().getSpecifiedName()); - javaSecondaryTables = typeResource.supportingAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); assertEquals("BAR", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); assertEquals("FOO", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName()); @@ -1005,9 +1007,9 @@ public class JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<SecondaryTable> secondaryTables = entity.specifiedSecondaryTables(); assertEquals("FOO", secondaryTables.next().getName()); @@ -1015,32 +1017,32 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, SecondaryTablesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAR", secondaryTables.next().getName()); assertEquals("BAZ", secondaryTables.next().getName()); assertEquals("FOO", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, SecondaryTablesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAZ", secondaryTables.next().getName()); assertEquals("BAR", secondaryTables.next().getName()); assertEquals("FOO", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAZ", secondaryTables.next().getName()); assertEquals("FOO", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeSupportingAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAZ", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeSupportingAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertFalse(secondaryTables.hasNext()); } @@ -1112,14 +1114,14 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("FOO"); assertEquals(1, getJavaEntity().secondaryTablesSize()); assertEquals("FOO", getJavaEntity().secondaryTables().next().getSpecifiedName()); assertEquals("FOO", getJavaEntity().secondaryTables().next().getName()); - SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable2.setName("BAR"); assertEquals(2, getJavaEntity().secondaryTablesSize()); @@ -1127,7 +1129,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", secondaryTables.next().getSpecifiedName()); assertEquals("BAR", secondaryTables.next().getSpecifiedName()); - SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable3.setName("BAZ"); assertEquals(3, getJavaEntity().secondaryTablesSize()); @@ -1150,21 +1152,21 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("baz", secondaryTables.next().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTables = getJavaEntity().secondaryTables(); assertEquals(2, getJavaEntity().secondaryTablesSize()); assertEquals("bar", secondaryTables.next().getSpecifiedName()); assertEquals("baz", secondaryTables.next().getSpecifiedName()); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTables = getJavaEntity().secondaryTables(); assertEquals(1, getJavaEntity().secondaryTablesSize()); assertEquals("baz", secondaryTables.next().getSpecifiedName()); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTables = getJavaEntity().secondaryTables(); assertEquals(0, getJavaEntity().secondaryTablesSize()); @@ -1179,10 +1181,10 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator()); - assertEquals(1, typeResource.supportingAnnotationsSize()); + assertEquals(2, typeResource.annotationsSize()); assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize()); getJavaEntity().getGeneratorContainer().getSequenceGenerator().setName("foo"); @@ -1199,7 +1201,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNotNull(typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator()); //try adding another sequence generator, should get an IllegalStateException @@ -1216,12 +1218,12 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); getJavaEntity().getGeneratorContainer().removeSequenceGenerator(); assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator()); - assertNull(typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); //try removing the sequence generator again, should get an IllegalStateException try { @@ -1240,10 +1242,10 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR); + typeResource.addAnnotation(JPA.TABLE_GENERATOR); assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator()); - assertEquals(1, typeResource.supportingAnnotationsSize()); + assertEquals(2, typeResource.annotationsSize()); assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize()); getJavaEntity().getGeneratorContainer().getTableGenerator().setName("foo"); @@ -1260,7 +1262,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNotNull(typeResource.getAnnotation(JPA.TABLE_GENERATOR)); assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator()); //try adding another table generator, should get an IllegalStateException @@ -1277,12 +1279,12 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR); + typeResource.addAnnotation(JPA.TABLE_GENERATOR); getJavaEntity().getGeneratorContainer().removeTableGenerator(); assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator()); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(typeResource.getAnnotation(JPA.TABLE_GENERATOR)); //try removing the table generator again, should get an IllegalStateException try { @@ -1300,7 +1302,7 @@ public class JavaEntityTests extends ContextModelTestCase assertNotNull(getJavaEntity().getDiscriminatorColumn()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setName("foo"); assertEquals("foo", getJavaEntity().getDiscriminatorColumn().getSpecifiedName()); @@ -1309,7 +1311,7 @@ public class JavaEntityTests extends ContextModelTestCase assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName()); - typeResource.removeSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(getJavaEntity().getDiscriminatorColumn()); } @@ -1325,13 +1327,13 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("FOO"); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertFalse(specifiedPkJoinColumns.hasNext()); - pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("BAR"); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); @@ -1339,7 +1341,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedPkJoinColumns.hasNext()); - pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("BAZ"); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); @@ -1348,26 +1350,26 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedPkJoinColumns.hasNext()); //move an annotation to the resource model and verify the context model is updated - typeResource.moveSupportingAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS); + typeResource.moveAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertFalse(specifiedPkJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertFalse(specifiedPkJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertFalse(specifiedPkJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertFalse(specifiedPkJoinColumns.hasNext()); } @@ -1422,7 +1424,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - Iterator<NestableAnnotation> pkJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); @@ -1439,7 +1441,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - Iterator<NestableAnnotation> pkJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); @@ -1456,11 +1458,11 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME))); getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1); - Iterator<NestableAnnotation> pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); assertFalse(pkJoinColumnResources.hasNext()); @@ -1472,7 +1474,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1); - pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); assertFalse(pkJoinColumnResources.hasNext()); @@ -1482,12 +1484,12 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(0); - pkJoinColumnResources = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertFalse(pkJoinColumnResources.hasNext()); pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns(); assertFalse(pkJoinColumns.hasNext()); - assertNull(typeResource.getSupportingAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception { @@ -1501,7 +1503,7 @@ public class JavaEntityTests extends ContextModelTestCase entity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); entity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - ListIterator<NestableAnnotation> javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaPrimaryKeyJoinColumns)); @@ -1511,7 +1513,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); @@ -1523,7 +1525,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaPrimaryKeyJoinColumns = typeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName()); @@ -1536,9 +1538,9 @@ public class JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((PrimaryKeyJoinColumnAnnotation) typeResource.addSupportingAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); @@ -1546,32 +1548,32 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertFalse(primaryKeyJoinColumns.hasNext()); } @@ -1742,13 +1744,13 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -1756,7 +1758,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -1765,26 +1767,26 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - typeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + typeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); } @@ -1802,8 +1804,8 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(4, javaEntity.virtualAttributeOverridesSize()); AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -1835,8 +1837,8 @@ public class JavaEntityTests extends ContextModelTestCase fooMapping.getColumn().setSpecifiedScale(Integer.valueOf(7)); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(4, javaEntity.virtualAttributeOverridesSize()); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -1863,8 +1865,8 @@ public class JavaEntityTests extends ContextModelTestCase fooMapping.getColumn().setSpecifiedPrecision(null); fooMapping.getColumn().setSpecifiedScale(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); assertEquals("foo", virtualAttributeOverride.getName()); @@ -1896,8 +1898,8 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -1913,8 +1915,8 @@ public class JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedTable("BAR"); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -1925,8 +1927,8 @@ public class JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedName(null); idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); assertEquals("id", virtualAttributeOverride.getName()); @@ -1946,9 +1948,9 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, getJavaEntity().specifiedAttributeOverridesSize()); @@ -1995,7 +1997,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); annotation.setName("bar"); assertEquals(5, javaEntity.attributeOverridesSize()); } @@ -2011,7 +2013,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -2031,7 +2033,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -2050,11 +2052,11 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME))); getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - Iterator<NestableAnnotation> attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); @@ -2066,7 +2068,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); @@ -2076,12 +2078,12 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedAttributeOverride() throws Exception { @@ -2099,7 +2101,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<NestableAnnotation> javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaAttributeOverrides)); entity.moveSpecifiedAttributeOverride(2, 0); @@ -2108,7 +2110,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("id", attributeOverrides.next().getName()); assertEquals("foo", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); @@ -2120,7 +2122,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("basic", attributeOverrides.next().getName()); assertEquals("foo", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); @@ -2133,9 +2135,9 @@ public class JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); @@ -2143,32 +2145,32 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); } @@ -2281,13 +2283,13 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("FOO"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); @@ -2295,7 +2297,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAssociationOverrides.hasNext()); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAZ"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); @@ -2304,26 +2306,26 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAssociationOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - typeResource.moveSupportingAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES); + typeResource.moveAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertFalse(specifiedAssociationOverrides.hasNext()); } @@ -2341,8 +2343,8 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, javaEntity.virtualAssociationOverridesSize()); AssociationOverride virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); @@ -2372,8 +2374,8 @@ public class JavaEntityTests extends ContextModelTestCase joinColumn.setSpecifiedNullable(Boolean.FALSE); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); assertEquals(2, javaEntity.virtualAssociationOverridesSize()); virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); @@ -2401,8 +2403,8 @@ public class JavaEntityTests extends ContextModelTestCase //idMapping.getColumn().setSpecifiedName(null); //idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); assertEquals("oneToOne", virtualAssociationOverride.getName()); @@ -2464,9 +2466,9 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("FOO"); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertEquals(2, getJavaEntity().specifiedAssociationOverridesSize()); @@ -2507,7 +2509,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); annotation.setName("bar"); assertEquals(3, javaEntity.associationOverridesSize()); } @@ -2523,7 +2525,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); @@ -2543,7 +2545,7 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); @@ -2561,11 +2563,11 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME))); + assertEquals(2, CollectionTools.size(typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME))); getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true); - Iterator<NestableAnnotation> associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrideResources.next()).getName()); assertFalse(associationOverrideResources.hasNext()); @@ -2575,12 +2577,12 @@ public class JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true); - associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertFalse(associationOverrideResources.hasNext()); associationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertFalse(associationOverrides.hasNext()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedAssociationOverride() throws Exception { @@ -2597,7 +2599,7 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<NestableAnnotation> javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaAssociationOverrides)); @@ -2606,7 +2608,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("manyToOne", associationOverrides.next().getName()); assertEquals("oneToOne", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); @@ -2616,7 +2618,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("oneToOne", associationOverrides.next().getName()); assertEquals("manyToOne", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); } @@ -2628,9 +2630,9 @@ public class JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("FOO", associationOverrides.next().getName()); @@ -2638,32 +2640,32 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertFalse(associationOverrides.hasNext()); } @@ -2706,20 +2708,20 @@ public class JavaEntityTests extends ContextModelTestCase NamedQuery namedQuery1 = entity.getQueryContainer().addNamedQuery(0); namedQuery1.setName("FOO"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); NamedQuery namedQuery2 = entity.getQueryContainer().addNamedQuery(0); namedQuery2.setName("BAR"); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); NamedQuery namedQuery3 = entity.getQueryContainer().addNamedQuery(1); namedQuery3.setName("BAZ"); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); @@ -2748,24 +2750,24 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedQuery(1).setName("BAR"); entity.getQueryContainer().addNamedQuery(2).setName("BAZ"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.getQueryContainer().removeNamedQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); entity.getQueryContainer().removeNamedQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals(1, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); entity.getQueryContainer().removeNamedQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals(0, CollectionTools.size(javaNamedQueries)); } @@ -2779,7 +2781,7 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedQuery(0).setName("FOO"); - NamedNativeQueryAnnotation nativeQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation nativeQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); nativeQuery.setName("BAR"); assertEquals(1, entity.getQueryContainer().namedNativeQueriesSize()); @@ -2797,7 +2799,7 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO"); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertEquals(1, entity.getQueryContainer().namedQueriesSize()); @@ -2816,7 +2818,7 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedQuery(1).setName("BAR"); entity.getQueryContainer().addNamedQuery(2).setName("BAZ"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); @@ -2826,7 +2828,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); @@ -2838,7 +2840,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName()); @@ -2853,9 +2855,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.getPersistenceUnit().queriesSize()); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries(); assertEquals("FOO", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); @@ -2863,34 +2865,34 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(namedQueries.hasNext()); assertEquals(3, entity.getPersistenceUnit().queriesSize()); - typeResource.moveSupportingAnnotation(2, 0, NamedQueriesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, NamedQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedQueries(); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, NamedQueriesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, NamedQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); assertEquals(2, entity.getPersistenceUnit().queriesSize()); - typeResource.removeSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); assertEquals(1, entity.getPersistenceUnit().queriesSize()); - typeResource.removeSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedQueries(); assertFalse(namedQueries.hasNext()); assertEquals(0, entity.getPersistenceUnit().queriesSize()); @@ -2905,9 +2907,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.getQueryContainer().namedQueriesSize()); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((NamedQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.getQueryContainer().namedQueriesSize()); } @@ -2922,20 +2924,20 @@ public class JavaEntityTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().addNamedNativeQuery(0); namedNativeQuery.setName("FOO"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); NamedNativeQuery namedNativeQuery2 = entity.getQueryContainer().addNamedNativeQuery(0); namedNativeQuery2.setName("BAR"); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); NamedNativeQuery namedNativeQuery3 = entity.getQueryContainer().addNamedNativeQuery(1); namedNativeQuery3.setName("BAZ"); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); @@ -2962,24 +2964,24 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR"); entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.getQueryContainer().removeNamedNativeQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); entity.getQueryContainer().removeNamedNativeQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals(1, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); entity.getQueryContainer().removeNamedNativeQuery(0); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals(0, CollectionTools.size(javaNamedQueries)); } @@ -2994,17 +2996,16 @@ public class JavaEntityTests extends ContextModelTestCase entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR"); entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ"); - ListIterator<NestableAnnotation> javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); - entity.getQueryContainer().moveNamedNativeQuery(2, 0); ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); @@ -3016,7 +3017,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.supportingAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName()); @@ -3031,9 +3032,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.getPersistenceUnit().queriesSize()); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("FOO", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); @@ -3041,34 +3042,34 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(namedQueries.hasNext()); assertEquals(3, entity.getPersistenceUnit().queriesSize()); - typeResource.moveSupportingAnnotation(2, 0, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); assertEquals(2, entity.getPersistenceUnit().queriesSize()); - typeResource.removeSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedNativeQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); assertEquals(1, entity.getPersistenceUnit().queriesSize()); - typeResource.removeSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); namedQueries = entity.getQueryContainer().namedNativeQueries(); assertFalse(namedQueries.hasNext()); assertEquals(0, entity.getPersistenceUnit().queriesSize()); @@ -3083,9 +3084,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, entity.getQueryContainer().namedNativeQueriesSize()); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.getQueryContainer().namedNativeQueriesSize()); } @@ -3097,28 +3098,28 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); assertNull(getJavaEntity().getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); assertNull(getJavaEntity().getIdClass()); - assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); idClass.setValue("model.Foo"); assertEquals("model.Foo", getJavaEntity().getIdClass()); - assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); + assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); //test setting @IdClass value to null, IdClass annotation is removed idClass.setValue(null); assertNull(getJavaEntity().getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); //reset @IdClass value and then remove @IdClass - idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + idClass = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); idClass.setValue("model.Foo"); - typeResource.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME); assertNull(getJavaEntity().getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } public void testModifyIdClass() throws Exception { @@ -3128,15 +3129,15 @@ public class JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); assertNull(getJavaEntity().getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); getJavaEntity().setIdClass("model.Foo"); - assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); + assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); assertEquals("model.Foo", getJavaEntity().getIdClass()); getJavaEntity().setIdClass(null); assertNull(getJavaEntity().getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } public void testGetPrimaryKeyColumnNameWithAttributeOverride() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java index 38f306f140..74be9b8315 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java @@ -59,7 +59,7 @@ public class JavaGeneratedValueTests extends ContextModelTestCase //change resource model sequenceGenerator name, verify the context model is updated JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); generatedValue.setGenerator("foo"); @@ -79,7 +79,7 @@ public class JavaGeneratedValueTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals("foo", generatedValue.getGenerator()); } @@ -97,7 +97,7 @@ public class JavaGeneratedValueTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); } @@ -112,7 +112,7 @@ public class JavaGeneratedValueTests extends ContextModelTestCase //change resource model sequenceGenerator name, verify the context model is updated JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); generatedValue.setStrategy(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY); @@ -133,14 +133,14 @@ public class JavaGeneratedValueTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy()); idMapping.getGeneratedValue().setSpecifiedStrategy(null); assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); - generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); assertNull(generatedValue.getStrategy()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java index 7065b047ae..e5642f5dee 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java @@ -132,13 +132,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -162,12 +162,12 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -191,13 +191,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -220,13 +220,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -249,13 +249,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -278,13 +278,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -307,13 +307,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -336,13 +336,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -365,13 +365,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -394,13 +394,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testGetTemporal() throws Exception { @@ -426,12 +426,12 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); idMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetTemporalUpdatesFromResourceModelChange() throws Exception { @@ -446,12 +446,12 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(TemporalType.DATE, ((TemporalConverter) idMapping.getConverter()).getTemporalType()); - attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType()); assertFalse(idMapping.isDefault()); @@ -470,7 +470,7 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", idMapping.getColumn().getSpecifiedName()); @@ -489,9 +489,9 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator()); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(2, attributeResource.annotationsSize()); assertEquals(1, idMapping.getPersistenceUnit().generatorsSize()); idMapping.getGeneratorContainer().getSequenceGenerator().setName("foo"); @@ -512,7 +512,7 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNotNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator()); //try adding another sequence generator, should get an IllegalStateException @@ -533,13 +533,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); idMapping.getGeneratorContainer().removeSequenceGenerator(); assertNull(idMapping.getGeneratorContainer().getSequenceGenerator()); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); //try removing the sequence generator again, should get an IllegalStateException try { @@ -561,9 +561,9 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR); + attributeResource.addAnnotation(JPA.TABLE_GENERATOR); assertNotNull(idMapping.getGeneratorContainer().getTableGenerator()); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(2, attributeResource.annotationsSize()); assertEquals(1, idMapping.getPersistenceUnit().generatorsSize()); idMapping.getGeneratorContainer().getTableGenerator().setName("foo"); @@ -584,7 +584,7 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNotNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); assertNotNull(idMapping.getGeneratorContainer().getTableGenerator()); //try adding another table generator, should get an IllegalStateException @@ -605,13 +605,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.TABLE_GENERATOR); + attributeResource.addAnnotation(JPA.TABLE_GENERATOR); idMapping.getGeneratorContainer().removeTableGenerator(); assertNull(idMapping.getGeneratorContainer().getTableGenerator()); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); //try removing the table generator again, should get an IllegalStateException try { @@ -633,10 +633,10 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.GENERATED_VALUE); + attributeResource.addAnnotation(JPA.GENERATED_VALUE); assertNotNull(idMapping.getGeneratedValue()); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(2, attributeResource.annotationsSize()); } public void testGetGeneratedValue2() throws Exception { @@ -650,7 +650,7 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNotNull(idMapping.getGeneratedValue()); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(2, attributeResource.annotationsSize()); } public void testAddGeneratedValue() throws Exception { @@ -667,7 +667,7 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE)); + assertNotNull(attributeResource.getAnnotation(JPA.GENERATED_VALUE)); assertNotNull(idMapping.getGeneratedValue()); //try adding another generated value, should get an IllegalStateException @@ -688,13 +688,13 @@ public class JavaIdMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(JPA.GENERATED_VALUE); + attributeResource.addAnnotation(JPA.GENERATED_VALUE); idMapping.removeGeneratedValue(); assertNull(idMapping.getGeneratedValue()); - assertNull(attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE)); + assertNull(attributeResource.getAnnotation(JPA.GENERATED_VALUE)); //try removing the generatedValue again, should get an IllegalStateException try { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java index 9e74ee7051..356a7dfaa0 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java @@ -98,14 +98,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set name in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); assertEquals("FOO", joinColumn.getSpecifiedName()); @@ -114,7 +114,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase //set name to null in the resource model, annotation removed, specified join column removed javaJoinColumn.setName(null); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedName() throws Exception { @@ -131,14 +131,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0); //set name in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("foo", joinColumn.getSpecifiedName()); assertEquals("foo", javaJoinColumn.getName()); //set name to null in the context model joinColumn.setSpecifiedName(null); assertNull(joinColumn.getSpecifiedName()); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } // <attribute name>_<referenced column name> @@ -196,14 +196,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set referenced column name in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setReferencedColumnName("BAR"); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -231,7 +231,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedReferencedColumnName("BAR"); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName()); assertEquals("BAR", javaJoinColumn.getReferencedColumnName()); @@ -256,14 +256,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set table in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setTable("BAR"); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -292,7 +292,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedTable("BAR"); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("BAR", joinColumn.getSpecifiedTable()); assertEquals("BAR", javaJoinColumn.getTable()); @@ -317,14 +317,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set unique in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setUnique(Boolean.TRUE); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -353,7 +353,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedUnique(Boolean.TRUE); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, javaJoinColumn.getUnique()); @@ -373,14 +373,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set nullable in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setNullable(Boolean.FALSE); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -409,7 +409,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedNullable(Boolean.FALSE); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable()); assertEquals(Boolean.FALSE, javaJoinColumn.getNullable()); @@ -429,14 +429,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set insertable in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setInsertable(Boolean.FALSE); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -465,7 +465,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedInsertable(Boolean.FALSE); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable()); assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable()); @@ -485,14 +485,14 @@ public class JavaJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, joinColumns.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set updatable in the resource model, verify context model updated - javaJoinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setUpdatable(Boolean.FALSE); JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next(); @@ -521,7 +521,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedUpdatable(Boolean.FALSE); - JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable()); assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java index 45f636e707..9665063442 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java @@ -101,15 +101,15 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); assertNull(javaJoinTable); //set name in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setName("FOO"); assertEquals("FOO", joinTable.getSpecifiedName()); assertEquals("FOO", javaJoinTable.getName()); @@ -123,9 +123,9 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedName()); assertEquals("FOO", javaJoinTable.getName()); - attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedName() throws Exception { @@ -138,21 +138,21 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); assertNull(javaJoinTable); //set name in the context model, verify resource model modified joinTable.setSpecifiedName("foo"); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedName()); assertEquals("foo", javaJoinTable.getName()); //set name to null in the context model joinTable.setSpecifiedName(null); assertNull(joinTable.getSpecifiedName()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testDefaultName() throws Exception { @@ -173,7 +173,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); //target entity does not resolve, default name is null manyToManyMapping.setSpecifiedTargetEntity("Foo"); @@ -184,9 +184,9 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName()); //add the join table annotation, verify default join table name is the same - attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName()); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); //set a table on the target entity, very default join table name updates manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO"); @@ -207,15 +207,15 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); assertNull(javaJoinTable); //set schema in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setSchema("FOO"); assertEquals("FOO", joinTable.getSpecifiedSchema()); assertEquals("FOO", javaJoinTable.getSchema()); @@ -229,9 +229,9 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedSchema()); assertEquals("FOO", javaJoinTable.getSchema()); - attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedSchema() throws Exception { @@ -244,21 +244,21 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); assertNull(javaJoinTable); //set schema in the context model, verify resource model modified joinTable.setSpecifiedSchema("foo"); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedSchema()); assertEquals("foo", javaJoinTable.getSchema()); //set schema to null in the context model joinTable.setSpecifiedSchema(null); assertNull(joinTable.getSpecifiedSchema()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testUpdateSpecifiedCatalog() throws Exception { @@ -271,15 +271,15 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); assertNull(javaJoinTable); //set catalog in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setCatalog("FOO"); assertEquals("FOO", joinTable.getSpecifiedCatalog()); assertEquals("FOO", javaJoinTable.getCatalog()); @@ -293,9 +293,9 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedCatalog()); assertEquals("FOO", javaJoinTable.getCatalog()); - attributeResource.removeSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedCatalog() throws Exception { @@ -308,21 +308,21 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); assertNull(javaJoinTable); //set catalog in the context model, verify resource model modified joinTable.setSpecifiedCatalog("foo"); - javaJoinTable = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedCatalog()); assertEquals("foo", javaJoinTable.getCatalog()); //set catalog to null in the context model joinTable.setSpecifiedCatalog(null); assertNull(joinTable.getSpecifiedCatalog()); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testAddSpecifiedJoinColumn() throws Exception { @@ -339,7 +339,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("FOO"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("FOO", joinTableResource.joinColumnAt(0).getName()); @@ -381,7 +381,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.joinColumnsSize()); joinTable.removeSpecifiedJoinColumn(0); @@ -411,7 +411,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.joinColumnsSize()); @@ -447,7 +447,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableResource.addJoinColumn(0); joinTableResource.addJoinColumn(1); @@ -550,7 +550,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("FOO"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("FOO", joinTableResource.inverseJoinColumnAt(0).getName()); @@ -592,7 +592,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.inverseJoinColumnsSize()); joinTable.removeSpecifiedInverseJoinColumn(0); @@ -622,7 +622,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.inverseJoinColumnsSize()); @@ -658,7 +658,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableResource.addInverseJoinColumn(0); joinTableResource.addInverseJoinColumn(1); @@ -759,7 +759,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar"); @@ -781,7 +781,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); joinTableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar"); @@ -800,7 +800,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -821,7 +821,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -842,7 +842,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableAnnotation.uniqueConstraintsSize()); @@ -888,7 +888,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableAnnotation.uniqueConstraintsSize()); @@ -925,7 +925,7 @@ public class JavaJoinTableTests extends ContextModelTestCase JoinTable joinTable = manyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableAnnotation.addUniqueConstraint(0).addColumnName("FOO"); joinTableAnnotation.addUniqueConstraint(1).addColumnName("BAR"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java index 06dfe5cd18..269dd9c643 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java @@ -236,10 +236,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -258,9 +258,9 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -279,10 +279,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -301,10 +301,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -323,10 +323,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -345,10 +345,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -367,10 +367,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -389,10 +389,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -411,10 +411,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -433,10 +433,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdateSpecifiedTargetEntity() throws Exception { @@ -448,7 +448,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getSpecifiedTargetEntity()); assertNull(manyToMany.getTargetEntity()); @@ -473,7 +473,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getSpecifiedTargetEntity()); assertNull(manyToMany.getTargetEntity()); @@ -498,7 +498,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getSpecifiedFetch()); assertNull(manyToMany.getFetch()); @@ -528,7 +528,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getSpecifiedFetch()); assertNull(manyToMany.getFetch()); @@ -537,11 +537,10 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, manyToMany.getFetch()); - + manyToManyMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, manyToMany.getFetch()); - //set fetch to null in the context model manyToManyMapping.setSpecifiedFetch(null); @@ -558,7 +557,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute()); assertNull(manyToMany.getMappedBy()); @@ -583,7 +582,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute()); assertNull(manyToMany.getMappedBy()); @@ -746,12 +745,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(manyToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); //set mapKey in the resource model, verify context model does not change - attributeResource.addSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getMapKey()); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNotNull(mapKey); //set mapKey name in the resource model, verify context model updated @@ -765,9 +764,9 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase assertNull(mapKey.getName()); mapKey.setName("myMapKey"); - attributeResource.removeSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); } public void testModifyMapKey() throws Exception { @@ -781,18 +780,18 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(manyToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); //set mapKey in the context model, verify resource model updated manyToManyMapping.setMapKey("myMapKey"); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertEquals("myMapKey", manyToManyMapping.getMapKey()); assertEquals("myMapKey", mapKey.getName()); //set mapKey to null in the context model manyToManyMapping.setMapKey(null); assertNull(manyToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); } public void testUpdateOrderBy() throws Exception { @@ -806,19 +805,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(manyToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertEquals("newOrderBy", manyToManyMapping.getOrderBy()); assertEquals("newOrderBy", orderBy.getValue()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertNull(manyToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testModifyOrderBy() throws Exception { @@ -832,18 +831,18 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(manyToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set mappedBy in the context model, verify resource model updated manyToManyMapping.setOrderBy("newOrderBy"); assertEquals("newOrderBy", manyToManyMapping.getOrderBy()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertEquals("newOrderBy", orderBy.getValue()); //set mappedBy to null in the context model manyToManyMapping.setOrderBy(null); assertNull(manyToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdateNoOrdering() throws Exception { @@ -857,20 +856,20 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertTrue(manyToManyMapping.isNoOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(manyToManyMapping.isNoOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertFalse(manyToManyMapping.isNoOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertTrue(manyToManyMapping.isNoOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testModifyNoOrdering() throws Exception { @@ -884,7 +883,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertTrue(manyToManyMapping.isNoOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); // manyToManyMapping.setNoOrdering(false); //this does nothing // //set mappedBy in the context model, verify resource model updated @@ -910,20 +909,20 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(manyToManyMapping.isPkOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertTrue(manyToManyMapping.isPkOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertFalse(manyToManyMapping.isPkOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(manyToManyMapping.isPkOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdateCustomOrdering() throws Exception { @@ -937,20 +936,20 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(manyToManyMapping.isCustomOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(manyToManyMapping.isCustomOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertTrue(manyToManyMapping.isCustomOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(manyToManyMapping.isCustomOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testDefaultTargetEntityForMap() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java index 86060f59af..ffc129348d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java @@ -190,9 +190,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -211,8 +211,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -231,9 +231,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -252,9 +252,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -273,9 +273,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -294,9 +294,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -315,9 +315,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -336,9 +336,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -357,9 +357,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -378,9 +378,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testUpdateSpecifiedTargetEntity() throws Exception { @@ -392,7 +392,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME); assertNull(manyToOneMapping.getSpecifiedTargetEntity()); assertNull(manyToOne.getTargetEntity()); @@ -417,7 +417,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME); assertNull(manyToOneMapping.getSpecifiedTargetEntity()); assertNull(manyToOne.getTargetEntity()); @@ -426,7 +426,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase manyToOneMapping.setSpecifiedTargetEntity("newTargetEntity"); assertEquals("newTargetEntity", manyToOneMapping.getSpecifiedTargetEntity()); assertEquals("newTargetEntity", manyToOne.getTargetEntity()); - + //set target entity to null in the context model manyToOneMapping.setSpecifiedTargetEntity(null); assertNull(manyToOneMapping.getSpecifiedTargetEntity()); @@ -442,7 +442,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME); assertNull(manyToOneMapping.getSpecifiedOptional()); assertNull(manyToOne.getOptional()); @@ -451,11 +451,10 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase manyToOne.setOptional(Boolean.TRUE); assertEquals(Boolean.TRUE, manyToOneMapping.getSpecifiedOptional()); assertEquals(Boolean.TRUE, manyToOne.getOptional()); - + manyToOne.setOptional(Boolean.FALSE); assertEquals(Boolean.FALSE, manyToOneMapping.getSpecifiedOptional()); assertEquals(Boolean.FALSE, manyToOne.getOptional()); - //set optional to null in the resource model manyToOne.setOptional(null); @@ -472,7 +471,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME); assertNull(manyToOneMapping.getSpecifiedOptional()); assertNull(manyToOne.getOptional()); @@ -510,13 +509,13 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAR"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); @@ -524,7 +523,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); @@ -533,26 +532,26 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); //move an annotation to the resource model and verify the context model is updated - attributeResource.moveSupportingAnnotation(1, 0, JPA.JOIN_COLUMNS); + attributeResource.moveAnnotation(1, 0, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); assertEquals("BAZ", specifiedJoinColumns.next().getName()); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertFalse(specifiedJoinColumns.hasNext()); } @@ -613,7 +612,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); @@ -635,7 +634,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumnsIterator = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); @@ -657,11 +656,11 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME))); joinColumns.removeSpecifiedJoinColumn(1); - Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -673,7 +672,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase joinColumns.removeSpecifiedJoinColumn(1); - joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -683,12 +682,12 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase joinColumns.removeSpecifiedJoinColumn(0); - joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertFalse(joinColumnResources.hasNext()); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertFalse(joinColumnsIterator.hasNext()); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedJoinColumn() throws Exception { @@ -705,17 +704,16 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next(); - ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaJoinColumns)); - joinColumns.moveSpecifiedJoinColumn(2, 0); ListIterator<? extends JoinColumn> primaryKeyJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -727,7 +725,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -742,9 +740,9 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase JoinColumnJoiningStrategy joinColumns = manyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next(); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("FOO", joinColumnsIterator.next().getName()); @@ -752,32 +750,32 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.moveSupportingAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAR", joinColumnsIterator.next().getName()); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.moveSupportingAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("BAR", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertFalse(joinColumnsIterator.hasNext()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java index d951c22f56..994b7d28d3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java @@ -55,8 +55,8 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof Entity); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); - assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddable() throws Exception { @@ -70,8 +70,8 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } public void testMorphToNull() throws Exception { @@ -85,8 +85,8 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } @@ -199,28 +199,28 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping(); assertNull(mappedSuperclass.getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); assertNull(mappedSuperclass.getIdClass()); - assertNotNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); idClass.setValue("model.Foo"); assertEquals("model.Foo", mappedSuperclass.getIdClass()); - assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); + assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); //test setting @IdClass value to null, IdClass annotation is removed idClass.setValue(null); assertNull(mappedSuperclass.getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); //reset @IdClass value and then remove @IdClass - idClass = (IdClassAnnotation) typeResource.addSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + idClass = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME); idClass.setValue("model.Foo"); - typeResource.removeSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME); assertNull(mappedSuperclass.getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } public void testModifyIdClass() throws Exception { @@ -231,15 +231,15 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase MappedSuperclass mappedSuperclass = (MappedSuperclass) getJavaPersistentType().getMapping(); assertNull(mappedSuperclass.getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); mappedSuperclass.setIdClass("model.Foo"); - assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); + assertEquals("model.Foo", ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue()); assertEquals("model.Foo", mappedSuperclass.getIdClass()); mappedSuperclass.setIdClass(null); assertNull(mappedSuperclass.getIdClass()); - assertNull(typeResource.getSupportingAnnotation(IdClassAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java index 66139509fa..0460ea83c2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java @@ -55,7 +55,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedNativeQuery.getName()); assertEquals(QUERY_NAME, namedNativeQuery.getName()); @@ -78,7 +78,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedNativeQuery.getName()); assertEquals(QUERY_NAME, namedNativeQuery.getName()); @@ -102,7 +102,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery()); assertEquals(QUERY_QUERY, namedNativeQuery.getQuery()); @@ -125,7 +125,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery()); assertEquals(QUERY_QUERY, namedNativeQuery.getQuery()); @@ -149,7 +149,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); QueryHint queryHint = namedNativeQuery.addHint(0); @@ -194,7 +194,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); namedNativeQuery.addHint(0).setName("FOO"); namedNativeQuery.addHint(1).setName("BAR"); @@ -222,7 +222,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); namedNativeQuery.addHint(0).setName("FOO"); namedNativeQuery.addHint(1).setName("BAR"); @@ -260,7 +260,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); javaNamedNativeQuery.addHint(0); javaNamedNativeQuery.addHint(1); @@ -314,7 +314,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase assertEquals(0, namedNativeQuery.hintsSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); javaNamedNativeQuery.addHint(0); @@ -336,7 +336,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultClass()); assertEquals(null, namedNativeQuery.getResultClass()); @@ -359,7 +359,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultClass()); assertEquals(null, namedNativeQuery.getResultClass()); @@ -383,7 +383,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultSetMapping()); assertEquals(null, namedNativeQuery.getResultSetMapping()); @@ -406,7 +406,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase NamedNativeQuery namedNativeQuery = entity.getQueryContainer().namedNativeQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultSetMapping()); assertEquals(null, namedNativeQuery.getResultSetMapping()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java index ace94bee93..84bdee49d6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java @@ -55,7 +55,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedQuery.getName()); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -78,7 +78,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedQuery.getName()); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -102,7 +102,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedQuery.getQuery()); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -125,7 +125,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedQuery.getQuery()); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -149,7 +149,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); QueryHint queryHint = namedQuery.addHint(0); @@ -188,7 +188,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1).setName("BAR"); @@ -216,7 +216,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1).setName("BAR"); @@ -254,7 +254,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase NamedQuery namedQuery = entity.getQueryContainer().namedQueries().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); javaNamedQuery.addHint(0); javaNamedQuery.addHint(1); @@ -308,7 +308,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase assertEquals(0, namedQuery.hintsSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME); javaNamedQuery.addHint(0); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java index 29cbf0d5e0..ac0a0ccfc5 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java @@ -237,10 +237,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -259,9 +259,9 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -280,10 +280,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -302,10 +302,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -324,10 +324,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -346,10 +346,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -368,10 +368,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -390,10 +390,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -412,10 +412,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -434,10 +434,10 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } @@ -450,7 +450,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getSpecifiedTargetEntity()); assertNull(oneToMany.getTargetEntity()); @@ -475,7 +475,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getSpecifiedTargetEntity()); assertNull(oneToMany.getTargetEntity()); @@ -500,7 +500,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getSpecifiedFetch()); assertNull(oneToMany.getFetch()); @@ -530,7 +530,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getSpecifiedFetch()); assertNull(oneToMany.getFetch()); @@ -543,7 +543,6 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToMany.getFetch()); - //set fetch to null in the context model oneToManyMapping.setSpecifiedFetch(null); @@ -560,7 +559,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute()); assertNull(oneToMany.getMappedBy()); @@ -585,7 +584,7 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute()); assertNull(oneToMany.getMappedBy()); @@ -748,12 +747,12 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(oneToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); //set mapKey in the resource model, verify context model does not change - attributeResource.addSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getMapKey()); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNotNull(mapKey); //set mapKey name in the resource model, verify context model updated @@ -767,9 +766,9 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase assertNull(mapKey.getName()); mapKey.setName("myMapKey"); - attributeResource.removeSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); } public void testModifyMapKey() throws Exception { @@ -783,18 +782,18 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(oneToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); //set mapKey in the context model, verify resource model updated oneToManyMapping.setMapKey("myMapKey"); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); assertEquals("myMapKey", oneToManyMapping.getMapKey()); assertEquals("myMapKey", mapKey.getName()); //set mapKey to null in the context model oneToManyMapping.setMapKey(null); assertNull(oneToManyMapping.getMapKey()); - assertNull(attributeResource.getSupportingAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(MapKeyAnnotation.ANNOTATION_NAME)); } public void testUpdateOrderBy() throws Exception { @@ -808,19 +807,19 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(oneToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertEquals("newOrderBy", oneToManyMapping.getOrderBy()); assertEquals("newOrderBy", orderBy.getValue()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertNull(oneToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testModifyOrderBy() throws Exception { @@ -834,18 +833,18 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertNull(oneToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set mappedBy in the context model, verify resource model updated oneToManyMapping.setOrderBy("newOrderBy"); assertEquals("newOrderBy", oneToManyMapping.getOrderBy()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertEquals("newOrderBy", orderBy.getValue()); //set mappedBy to null in the context model oneToManyMapping.setOrderBy(null); assertNull(oneToManyMapping.getOrderBy()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdateNoOrdering() throws Exception { @@ -859,20 +858,20 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertTrue(oneToManyMapping.isNoOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(oneToManyMapping.isNoOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertFalse(oneToManyMapping.isNoOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertTrue(oneToManyMapping.isNoOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdatePkOrdering() throws Exception { @@ -886,20 +885,20 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(oneToManyMapping.isPkOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertTrue(oneToManyMapping.isPkOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertFalse(oneToManyMapping.isPkOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(oneToManyMapping.isPkOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testUpdateCustomOrdering() throws Exception { @@ -913,20 +912,20 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); assertFalse(oneToManyMapping.isCustomOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); //set orderBy in the resource model, verify context model updated - attributeResource.addSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(oneToManyMapping.isCustomOrdering()); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME); orderBy.setValue("newOrderBy"); assertTrue(oneToManyMapping.isCustomOrdering()); //set orderBy to null in the resource model - attributeResource.removeSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); assertFalse(oneToManyMapping.isCustomOrdering()); - assertNull(attributeResource.getSupportingAnnotation(OrderByAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME)); } public void testDefaultTargetEntityForMap() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java index 6c10347445..aed0ec2a37 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java @@ -198,9 +198,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -219,8 +219,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -239,9 +239,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -260,9 +260,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -281,9 +281,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -302,9 +302,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -323,9 +323,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -344,9 +344,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -365,9 +365,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -386,9 +386,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME)); } @@ -401,7 +401,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedTargetEntity()); assertNull(oneToOne.getTargetEntity()); @@ -426,7 +426,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedTargetEntity()); assertNull(oneToOne.getTargetEntity()); @@ -452,7 +452,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(mappedBy.getMappedByAttribute()); assertNull(oneToOne.getMappedBy()); @@ -478,7 +478,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(mappedBy.getMappedByAttribute()); assertNull(oneToOne.getMappedBy()); @@ -503,7 +503,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedOptional()); assertNull(oneToOne.getOptional()); @@ -533,7 +533,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedOptional()); assertNull(oneToOne.getOptional()); @@ -542,7 +542,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.setSpecifiedOptional(Boolean.TRUE); assertEquals(Boolean.TRUE, oneToOneMapping.getSpecifiedOptional()); assertEquals(Boolean.TRUE, oneToOne.getOptional()); - + oneToOneMapping.setSpecifiedOptional(Boolean.FALSE); assertEquals(Boolean.FALSE, oneToOneMapping.getSpecifiedOptional()); assertEquals(Boolean.FALSE, oneToOne.getOptional()); @@ -563,7 +563,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedFetch()); assertNull(oneToOne.getFetch()); @@ -572,11 +572,10 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER); assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToOne.getFetch()); - + oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch()); - //set fetch to null in the resource model oneToOne.setFetch(null); @@ -593,7 +592,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); assertNull(oneToOneMapping.getSpecifiedFetch()); assertNull(oneToOne.getFetch()); @@ -606,7 +605,6 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch()); assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch()); - //set fetch to null in the context model oneToOneMapping.setSpecifiedFetch(null); @@ -630,13 +628,13 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAR"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); @@ -644,7 +642,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); @@ -653,26 +651,26 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); //move an annotation to the resource model and verify the context model is updated - attributeResource.moveSupportingAnnotation(1, 0, JPA.JOIN_COLUMNS); + attributeResource.moveAnnotation(1, 0, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); assertEquals("BAZ", specifiedJoinColumns.next().getName()); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); specifiedJoinColumns = joinColumns.specifiedJoinColumns(); assertFalse(specifiedJoinColumns.hasNext()); } @@ -738,7 +736,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); Iterator<NestableAnnotation> joinColumnsIterator = - attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); @@ -761,7 +759,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); Iterator<NestableAnnotation> joinColumnsIterator = - attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) joinColumnsIterator.next()).getName()); @@ -783,11 +781,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME))); joinColumns.removeSpecifiedJoinColumn(1); - Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -799,7 +797,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase joinColumns.removeSpecifiedJoinColumn(1); - joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -809,12 +807,12 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase joinColumns.removeSpecifiedJoinColumn(0); - joinColumnResources = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertFalse(joinColumnResources.hasNext()); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertFalse(joinColumnsIterator.hasNext()); - assertNull(attributeResource.getSupportingAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(JoinColumnsAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedJoinColumn() throws Exception { @@ -831,7 +829,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next(); - ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaJoinColumns)); @@ -841,7 +839,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -853,7 +851,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((JoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -868,9 +866,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JoinColumnJoiningStrategy joinColumns = oneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next(); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((JoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<? extends JoinColumn> joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("FOO", joinColumnsIterator.next().getName()); @@ -878,32 +876,32 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.moveSupportingAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(2, 0, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAR", joinColumnsIterator.next().getName()); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.moveSupportingAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(0, 1, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("BAR", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertEquals("FOO", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertEquals("BAZ", joinColumnsIterator.next().getName()); assertFalse(joinColumnsIterator.hasNext()); - attributeResource.removeSupportingAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); joinColumnsIterator = joinColumns.specifiedJoinColumns(); assertFalse(joinColumnsIterator.hasNext()); } @@ -1076,13 +1074,13 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); //add an annotation to the resource model and verify the context model is updated - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("BAR"); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); @@ -1090,7 +1088,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertFalse(primaryKeyJoinColumns.hasNext()); - joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("BAZ"); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); @@ -1099,26 +1097,26 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertFalse(primaryKeyJoinColumns.hasNext()); //move an annotation to the resource model and verify the context model is updated - attributeResource.moveSupportingAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.moveAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); primaryKeyJoinColumns = strategy.primaryKeyJoinColumns(); assertFalse(primaryKeyJoinColumns.hasNext()); } @@ -1156,7 +1154,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumns = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName()); @@ -1179,7 +1177,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumns = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) joinColumns.next()).getName()); @@ -1203,11 +1201,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME))); strategy.removePrimaryKeyJoinColumn(1); - Iterator<NestableAnnotation> joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> joinColumnResources = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName()); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -1219,7 +1217,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase strategy.removePrimaryKeyJoinColumn(1); - joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); @@ -1229,12 +1227,12 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase strategy.removePrimaryKeyJoinColumn(0); - joinColumnResources = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertFalse(joinColumnResources.hasNext()); joinColumns = strategy.primaryKeyJoinColumns(); assertFalse(joinColumns.hasNext()); - assertNull(attributeResource.getSupportingAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)); } public void testMovePrimaryKeyJoinColumn() throws Exception { @@ -1252,7 +1250,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase JavaResourcePersistentAttribute attributeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next(); - ListIterator<NestableAnnotation> javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaJoinColumns = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaJoinColumns)); @@ -1262,7 +1260,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -1274,7 +1272,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.supportingAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaJoinColumns.next()).getName()); @@ -1290,9 +1288,9 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase PrimaryKeyJoinColumnJoiningStrategy strategy = oneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy(); - ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<PrimaryKeyJoinColumn> joinColumns = strategy.primaryKeyJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); @@ -1300,32 +1298,32 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.moveSupportingAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); joinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.moveSupportingAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.moveAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); joinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); joinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); joinColumns = strategy.primaryKeyJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeSupportingAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); joinColumns = strategy.primaryKeyJoinColumns(); assertFalse(joinColumns.hasNext()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java index 51d129c09d..c80c08a7e8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java @@ -76,7 +76,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setName("FOO"); specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next(); @@ -125,13 +125,13 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertEquals("foo", specifiedPkJoinColumn.getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", pkJoinColumn.getName()); specifiedPkJoinColumn.setSpecifiedName(null); assertNull(specifiedPkJoinColumn.getSpecifiedName()); - pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(pkJoinColumn); } @@ -143,7 +143,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertNull(specifiedPkJoinColumn.getColumnDefinition()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); column.setColumnDefinition(COLUMN_DEFINITION); assertEquals(COLUMN_DEFINITION, specifiedPkJoinColumn.getColumnDefinition()); @@ -152,7 +152,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertNull(specifiedPkJoinColumn.getColumnDefinition()); - typeResource.removeSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + typeResource.removeAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(0, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize()); } @@ -165,12 +165,12 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase specifiedPkJoinColumn.setColumnDefinition("foo"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", column.getColumnDefinition()); specifiedPkJoinColumn.setColumnDefinition(null); - column = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + column = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(column.getColumnDefinition()); } @@ -182,7 +182,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setReferencedColumnName("FOO"); specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next(); @@ -219,7 +219,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setReferencedColumnName("FOO"); @@ -237,14 +237,14 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertEquals("foo", specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", pkJoinColumn.getReferencedColumnName()); specifiedPkJoinColumn.setSpecifiedName(null); specifiedPkJoinColumn.setSpecifiedReferencedColumnName(null); assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); - pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(pkJoinColumn); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java index 9fad86298f..ce4e4d1c25 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java @@ -53,7 +53,7 @@ public class JavaQueryHintTests extends ContextModelTestCase QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - QueryHintAnnotation javaQueryHint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); + QueryHintAnnotation javaQueryHint = ((NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryHint.getName()); assertNull(queryHint.getName()); @@ -77,7 +77,7 @@ public class JavaQueryHintTests extends ContextModelTestCase QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getName()); assertNull(queryHint.getName()); @@ -101,7 +101,7 @@ public class JavaQueryHintTests extends ContextModelTestCase QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getValue()); assertNull(queryHint.getValue()); @@ -125,7 +125,7 @@ public class JavaQueryHintTests extends ContextModelTestCase QueryHint queryHint = entity.getQueryContainer().namedQueries().next().hints().next(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getSupportingAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getValue()); assertNull(queryHint.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java index 6df0ff16fa..34e6f7cea7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java @@ -108,7 +108,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals("foo", getJavaEntity().secondaryTables().next().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("foo", table.getName()); } @@ -123,7 +123,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals(0, getJavaEntity().secondaryTablesSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); } public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception { @@ -131,7 +131,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.setName("foo"); assertEquals("foo", getJavaEntity().secondaryTables().next().getSpecifiedName()); @@ -142,7 +142,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); ((SecondaryTableAnnotation) secondaryTableResources.next()).setCatalog("foo"); ((SecondaryTableAnnotation) secondaryTableResources.next()).setCatalog("bar"); @@ -156,7 +156,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<NestableAnnotation> secondaryTableResources = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); ((SecondaryTableAnnotation) secondaryTableResources.next()).setSchema("foo"); ((SecondaryTableAnnotation) secondaryTableResources.next()).setSchema("bar"); @@ -170,7 +170,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.setCatalog("myCatalog"); @@ -197,12 +197,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase table.setSpecifiedName(null); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("myCatalog", tableResource.getCatalog()); table.setSpecifiedCatalog(null); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); } public void testGetSchema() throws Exception { @@ -210,7 +210,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); tableResource.setSchema("mySchema"); @@ -237,12 +237,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase table.setSpecifiedName(null); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("mySchema", tableResource.getSchema()); table.setSpecifiedSchema(null); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); } public void testSpecifiedPrimaryKeyJoinColumns() throws Exception { @@ -255,7 +255,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertFalse(specifiedPkJoinColumns.hasNext()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); //add an annotation to the resource model and verify the context model is updated PrimaryKeyJoinColumnAnnotation pkJoinColumn = tableResource.addPkJoinColumn(0); @@ -369,7 +369,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals("FOO", specifiedPkJoinColumns.next().getName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("BAZ", pkJoinColumns.next().getName()); @@ -394,7 +394,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); @@ -413,7 +413,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, tableResource.pkJoinColumnsSize()); @@ -464,7 +464,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); @@ -535,7 +535,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertFalse(uniqueConstraints.hasNext()); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar"); @@ -555,7 +555,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase assertEquals(0, secondaryTable.uniqueConstraintsSize()); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); secondaryTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); secondaryTableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar"); @@ -572,7 +572,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase secondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ"); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = secondaryTableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -591,7 +591,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase secondaryTable.addUniqueConstraint(0).addColumnName(0, "BAZ"); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = secondaryTableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -610,7 +610,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase secondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ"); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, secondaryTableAnnotation.uniqueConstraintsSize()); @@ -654,7 +654,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase secondaryTable.addUniqueConstraint(2).addColumnName(0, "BAZ"); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, secondaryTableAnnotation.uniqueConstraintsSize()); @@ -689,7 +689,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase SecondaryTable secondaryTable = getJavaEntity().specifiedSecondaryTables().next(); JavaResourcePersistentType resourcePersistentType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTableAnnotation = (SecondaryTableAnnotation) resourcePersistentType.getAnnotation(JPA.SECONDARY_TABLE); secondaryTableAnnotation.addUniqueConstraint(0).addColumnName("FOO"); secondaryTableAnnotation.addUniqueConstraint(1).addColumnName("BAR"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java index 5b4f09dab3..f758971830 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java @@ -60,7 +60,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase //change resource model sequenceGenerator name, verify the context model is updated JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setName("foo"); @@ -80,7 +80,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals("foo", sequenceGenerator.getName()); } @@ -98,7 +98,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertNull(sequenceGenerator); } @@ -112,7 +112,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getSequenceGenerator().getInitialValue()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setInitialValue(Integer.valueOf(82)); @@ -143,13 +143,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(Integer.valueOf(20), sequenceGenerator.getInitialValue()); idMapping.getGeneratorContainer().getSequenceGenerator().setName(null); idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedInitialValue(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); } public void testGetAllocationSize() throws Exception { @@ -162,7 +162,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setAllocationSize(Integer.valueOf(20)); @@ -193,13 +193,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(Integer.valueOf(25), sequenceGenerator.getAllocationSize()); idMapping.getGeneratorContainer().getSequenceGenerator().setName(null); idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedAllocationSize(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); } @@ -213,7 +213,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getSequenceGenerator().getSequenceName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setSequenceName("mySequenceName"); @@ -244,13 +244,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals("mySequenceName", sequenceGenerator.getSequenceName()); idMapping.getGeneratorContainer().getSequenceGenerator().setName(null); idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedSequenceName(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java index 7231ee7c23..1a1e8e1d8e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java @@ -69,7 +69,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase //change resource model tableGenerator name, verify the context model is updated JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setName("foo"); @@ -89,7 +89,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("foo", tableGenerator.getName()); } @@ -107,7 +107,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertNull(tableGenerator); } @@ -121,7 +121,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getTableGenerator().getCatalog()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setCatalog("myCatalog"); @@ -152,13 +152,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("myCatalog", tableGenerator.getCatalog()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedCatalog(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetSchema() throws Exception { @@ -170,7 +170,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getTableGenerator().getSchema()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setSchema("mySchema"); @@ -229,13 +229,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("mySchema", tableGenerator.getSchema()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedSchema(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetPkColumnName() throws Exception { @@ -247,7 +247,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getTableGenerator().getPkColumnName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setPkColumnName("myPkColumnName"); @@ -278,13 +278,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("myPkColumnName", tableGenerator.getPkColumnName()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnName(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetValueColumnName() throws Exception { @@ -296,7 +296,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getTableGenerator().getValueColumnName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setValueColumnName("myValueColumnName"); @@ -327,13 +327,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("myValueColumnName", tableGenerator.getValueColumnName()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedValueColumnName(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetPkColumnValue() throws Exception { @@ -345,7 +345,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertNull(idMapping.getGeneratorContainer().getTableGenerator().getPkColumnValue()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setPkColumnValue("myPkColumnValue"); @@ -376,13 +376,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals("myPkColumnValue", tableGenerator.getPkColumnValue()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedPkColumnValue(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetInitialValue() throws Exception { @@ -394,7 +394,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getGeneratorContainer().getTableGenerator().getInitialValue()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setInitialValue(Integer.valueOf(82)); @@ -425,13 +425,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(Integer.valueOf(20), tableGenerator.getInitialValue()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedInitialValue(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } public void testGetAllocationSize() throws Exception { @@ -444,7 +444,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.setAllocationSize(Integer.valueOf(20)); @@ -475,13 +475,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(Integer.valueOf(25), tableGenerator.getAllocationSize()); idMapping.getGeneratorContainer().getTableGenerator().setName(null); idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedAllocationSize(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR)); } @@ -496,7 +496,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "bar"); @@ -517,7 +517,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); tableGeneratorAnnotation.addUniqueConstraint(1).addColumnName(0, "bar"); @@ -535,7 +535,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableGeneratorAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -555,7 +555,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableGeneratorAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -575,7 +575,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(3, tableGeneratorAnnotation.uniqueConstraintsSize()); @@ -620,7 +620,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(3, tableGeneratorAnnotation.uniqueConstraintsSize()); @@ -656,7 +656,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase TableGenerator tableGenerator = ((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getGeneratorContainer().getTableGenerator(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGeneratorAnnotation = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGeneratorAnnotation.addUniqueConstraint(0).addColumnName("FOO"); tableGeneratorAnnotation.addUniqueConstraint(1).addColumnName("BAR"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java index f972a4f2be..262e40d131 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java @@ -215,7 +215,7 @@ public class JavaTableTests extends ContextModelTestCase assertEquals("foo", getJavaEntity().getTable().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals("foo", table.getName()); } @@ -229,7 +229,7 @@ public class JavaTableTests extends ContextModelTestCase assertNull(getJavaEntity().getTable().getSpecifiedName()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNull(table); } @@ -239,12 +239,12 @@ public class JavaTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.setName("foo"); assertEquals("foo", getJavaEntity().getTable().getSpecifiedName()); - typeResource.removeSupportingAnnotation(JPA.TABLE); + typeResource.removeAnnotation(JPA.TABLE); assertNull(getJavaEntity().getTable().getSpecifiedName()); } @@ -253,7 +253,7 @@ public class JavaTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.setCatalog("myCatalog"); @@ -316,12 +316,12 @@ public class JavaTableTests extends ContextModelTestCase table.setSpecifiedCatalog("myCatalog"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableResource = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals("myCatalog", tableResource.getCatalog()); table.setSpecifiedCatalog(null); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } public void testGetSchema() throws Exception { @@ -329,7 +329,7 @@ public class JavaTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.setSchema("mySchema"); @@ -355,12 +355,12 @@ public class JavaTableTests extends ContextModelTestCase table.setSpecifiedSchema("mySchema"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableResource = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals("mySchema", tableResource.getSchema()); table.setSpecifiedSchema(null); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } public void testUniqueConstraints() throws Exception { @@ -371,7 +371,7 @@ public class JavaTableTests extends ContextModelTestCase assertFalse(uniqueConstraints.hasNext()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); tableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); tableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar"); @@ -389,7 +389,7 @@ public class JavaTableTests extends ContextModelTestCase assertEquals(0, getJavaEntity().getTable().uniqueConstraintsSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); tableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo"); tableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar"); @@ -406,7 +406,7 @@ public class JavaTableTests extends ContextModelTestCase table.addUniqueConstraint(0).addColumnName(0, "BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -425,7 +425,7 @@ public class JavaTableTests extends ContextModelTestCase table.addUniqueConstraint(0).addColumnName(0, "BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); ListIterator<UniqueConstraintAnnotation> uniqueConstraints = tableAnnotation.uniqueConstraints(); assertEquals("BAZ", uniqueConstraints.next().columnNames().next()); @@ -444,7 +444,7 @@ public class JavaTableTests extends ContextModelTestCase table.addUniqueConstraint(2).addColumnName(0, "BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(3, tableAnnotation.uniqueConstraintsSize()); @@ -488,7 +488,7 @@ public class JavaTableTests extends ContextModelTestCase table.addUniqueConstraint(2).addColumnName(0, "BAZ"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(3, tableAnnotation.uniqueConstraintsSize()); @@ -523,7 +523,7 @@ public class JavaTableTests extends ContextModelTestCase Table table = getJavaEntity().getTable(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); tableAnnotation.addUniqueConstraint(0).addColumnName("FOO"); tableAnnotation.addUniqueConstraint(1).addColumnName("BAR"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java index 6f2ca904a6..94e013b467 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java @@ -78,8 +78,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -96,7 +96,7 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { @@ -112,8 +112,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -129,8 +129,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -146,8 +146,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -163,8 +163,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -180,8 +180,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -197,8 +197,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -214,8 +214,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -231,8 +231,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); } public void testTransientMapping() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java index a8b6f2cce9..edbb6cb7ee 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java @@ -105,10 +105,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(BasicAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -129,9 +129,9 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -152,10 +152,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(IdAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -175,10 +175,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -198,10 +198,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(TransientAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -221,10 +221,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -244,10 +244,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -267,10 +267,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -290,10 +290,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -313,10 +313,10 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getMappingAnnotation(VersionAnnotation.ANNOTATION_NAME)); - assertNotNull(attributeResource.getMappingAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(ColumnAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } @@ -343,12 +343,12 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); versionMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetTemporalUpdatesFromResourceModelChange() throws Exception { @@ -363,12 +363,12 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME); temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(TemporalType.DATE, ((TemporalConverter) versionMapping.getConverter()).getTemporalType()); - attributeResource.removeSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType()); assertFalse(versionMapping.isDefault()); @@ -387,12 +387,11 @@ public class JavaVersionMappingTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.addSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", versionMapping.getColumn().getSpecifiedName()); assertEquals("foo", versionMapping.getColumn().getName()); assertEquals("id", versionMapping.getColumn().getDefaultName()); } - } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaAssociationOverrideTests.java index 520f087f04..4c355cdc4c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaAssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaAssociationOverrideTests.java @@ -131,7 +131,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod javaAssociationOverride = javaAssociationOverride.setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("address", javaAssociationOverride.getName()); assertEquals("address", associationOverrideResource.getName()); @@ -151,9 +151,9 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod assertEquals("FOO", javaAssociationOverride.getName()); assertEquals("FOO", associationOverrideResource.getName()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertFalse(getJavaEntity().specifiedAssociationOverrides().hasNext()); - assertFalse(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext()); + assertFalse(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext()); } public void testModifyName() throws Exception { @@ -167,7 +167,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod javaAssociationOverride = javaAssociationOverride.setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("address", javaAssociationOverride.getName()); assertEquals("address", associationOverrideResource.getName()); @@ -181,7 +181,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod //set name to null in the context model javaAssociationOverride.setName(null); assertNull(javaAssociationOverride.getName()); - associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNull(associationOverrideResource.getName()); } @@ -198,7 +198,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumn joinColumn = joiningStrategy.addSpecifiedJoinColumn(0); @@ -242,7 +242,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(1, associationOverrideResource.joinColumnsSize()); @@ -280,7 +280,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); joiningStrategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); joiningStrategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -323,7 +323,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JavaJoinColumnJoiningStrategy joiningStrategy = javaAssociationOverride.getRelationshipReference().getJoinColumnJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.specifiedJoinColumns(); JoinColumn joinColumn = joinColumns.next(); @@ -391,7 +391,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverrideResource.setName("FOO"); specifiedAssociationOverride = getJavaEntity().specifiedAssociationOverrides().next(); @@ -408,7 +408,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod specifiedAssociationOverride.setName("FOO"); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("FOO", associationOverrideResource.getName()); } @@ -455,7 +455,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JoinTableJoiningStrategy joiningStrategy = ((AssociationOverrideRelationshipReference2_0) javaAssociationOverride.getRelationshipReference()).getJoinTableJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverride2_0Annotation associationOverrideResource = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverrideResource = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTable joinTable = joiningStrategy.getJoinTable(); @@ -477,7 +477,7 @@ public class Generic2_0JavaAssociationOverrideTests extends Generic2_0ContextMod JoinTableJoiningStrategy joiningStrategy = ((AssociationOverrideRelationshipReference2_0) javaAssociationOverride.getRelationshipReference()).getJoinTableJoiningStrategy(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild"); - AssociationOverride2_0Annotation associationOverrideResource = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverrideResource = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverrideResource.getJoinTable().setName("MY_JOIN_TABLE"); assertEquals("MY_JOIN_TABLE", joiningStrategy.getJoinTable().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaEntityTests.java index 7c14c617bd..0f7de785e2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaEntityTests.java @@ -429,13 +429,13 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -443,7 +443,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -452,26 +452,26 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - typeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + typeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertEquals("BAR", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); specifiedAttributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); } @@ -489,8 +489,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -506,8 +506,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedTable("BAR"); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -518,8 +518,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedName(null); idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); assertEquals("id", virtualAttributeOverride.getName()); @@ -543,8 +543,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); AttributeOverride virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -560,8 +560,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedTable("BAR"); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); assertEquals(3, javaEntity.virtualAttributeOverridesSize()); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); @@ -572,8 +572,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedName(null); idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); virtualAttributeOverride = javaEntity.virtualAttributeOverrides().next(); assertEquals("id", virtualAttributeOverride.getName()); @@ -593,9 +593,9 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, getJavaEntity().specifiedAttributeOverridesSize()); @@ -639,7 +639,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); annotation.setName("bar"); assertEquals(4, javaEntity.attributeOverridesSize()); } @@ -655,7 +655,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("name", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -675,7 +675,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("name", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); @@ -694,11 +694,11 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAttributeOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME))); getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - Iterator<NestableAnnotation> attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("name", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); @@ -710,7 +710,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); @@ -720,12 +720,12 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAttributeOverrides().next().setVirtual(true); - attributeOverrideResources = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = getJavaEntity().specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); - assertNull(typeResource.getSupportingAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedAttributeOverride() throws Exception { @@ -743,7 +743,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<NestableAnnotation> javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaAttributeOverrides)); @@ -753,7 +753,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("foo", attributeOverrides.next().getName()); assertEquals("id", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("name", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); @@ -765,7 +765,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("name", attributeOverrides.next().getName()); assertEquals("id", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.supportingAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("name", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName()); @@ -778,9 +778,9 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); @@ -788,32 +788,32 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); } @@ -925,13 +925,13 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("FOO"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); @@ -939,7 +939,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAssociationOverrides.hasNext()); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAZ"); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); @@ -948,26 +948,26 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAssociationOverrides.hasNext()); //move an annotation to the resource model and verify the context model is updated - typeResource.moveSupportingAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES); + typeResource.moveAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("FOO", specifiedAssociationOverrides.next().getName()); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAZ", specifiedAssociationOverrides.next().getName()); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertEquals("BAR", specifiedAssociationOverrides.next().getName()); assertFalse(specifiedAssociationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); specifiedAssociationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertFalse(specifiedAssociationOverrides.hasNext()); } @@ -985,8 +985,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); assertEquals(4, javaEntity.virtualAssociationOverridesSize()); AssociationOverride virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); @@ -999,8 +999,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase //idMapping.getColumn().setSpecifiedTable("BAR"); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); assertEquals(4, javaEntity.virtualAssociationOverridesSize()); virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); @@ -1009,8 +1009,8 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase //idMapping.getColumn().setSpecifiedName(null); //idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); virtualAssociationOverride = javaEntity.virtualAssociationOverrides().next(); assertEquals("address", virtualAssociationOverride.getName()); @@ -1072,9 +1072,9 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("FOO"); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertEquals(2, getJavaEntity().specifiedAssociationOverridesSize()); @@ -1121,7 +1121,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); annotation.setName("bar"); assertEquals(5, javaEntity.associationOverridesSize()); } @@ -1137,7 +1137,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("address", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("address2", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); @@ -1157,7 +1157,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("address2", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("address", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); @@ -1175,11 +1175,11 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().virtualAssociationOverrides().next().setVirtual(false); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME))); + assertEquals(2, CollectionTools.size(typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME))); getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true); - Iterator<NestableAnnotation> associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("address2", ((AssociationOverrideAnnotation) associationOverrideResources.next()).getName()); assertFalse(associationOverrideResources.hasNext()); @@ -1189,12 +1189,12 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase getJavaEntity().specifiedAssociationOverrides().next().setVirtual(true); - associationOverrideResources = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertFalse(associationOverrideResources.hasNext()); associationOverrides = getJavaEntity().specifiedAssociationOverrides(); assertFalse(associationOverrides.hasNext()); - assertNull(typeResource.getSupportingAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME)); } public void testMoveSpecifiedAssociationOverride() throws Exception { @@ -1211,7 +1211,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<NestableAnnotation> javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + Iterator<NestableAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaAssociationOverrides)); @@ -1220,7 +1220,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("address2", associationOverrides.next().getName()); assertEquals("address", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("address2", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); assertEquals("address", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); @@ -1230,7 +1230,7 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("address", associationOverrides.next().getName()); assertEquals("address2", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.supportingAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); assertEquals("address", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); assertEquals("address2", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName()); } @@ -1242,9 +1242,9 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase Entity entity = getJavaEntity(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); - ((AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ"); ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("FOO", associationOverrides.next().getName()); @@ -1252,32 +1252,32 @@ public class Generic2_0JavaEntityTests extends ContextModelTestCase assertEquals("BAZ", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.moveSupportingAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.moveSupportingAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.moveAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeSupportingAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertFalse(associationOverrides.hasNext()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentAttributeTests.java index 36e299e3c5..f54483c387 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentAttributeTests.java @@ -14,13 +14,27 @@ import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jpt.core.MappingKeys; import org.eclipse.jpt.core.context.AccessType; import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @SuppressWarnings("nls") public class Generic2_0JavaPersistentAttributeTests extends Generic2_0ContextModelTestCase { - + private ICompilationUnit createTestEntityForDerivedId() throws Exception { + return createTestType(new DefaultAnnotationWriter() { + @Override + public Iterator<String> imports() { + return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.ONE_TO_ONE, JPA.MANY_TO_ONE); + } + + @Override + public void appendTypeAnnotationTo(StringBuilder sb) { + sb.append("@Entity"); + } + }); + } + private ICompilationUnit createTestEntitySpecifiedAccessField() throws Exception { return this.createTestType(new DefaultAnnotationWriter() { @Override @@ -107,4 +121,32 @@ public class Generic2_0JavaPersistentAttributeTests extends Generic2_0ContextMod assertEquals(AccessType.PROPERTY, idPersistentAttribute.getDefaultAccess()); assertEquals(null, idPersistentAttribute.getSpecifiedAccess()); } + + public void testDerivedIdMappingInitialization() throws Exception { + createTestEntityForDerivedId(); + addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); + + JavaPersistentAttribute id = getJavaPersistentType().getAttributeNamed("id"); + assertEquals(id.getMappingKey(), MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + + id.getResourcePersistentAttribute().addAnnotation(JPA.ID); + assertEquals(id.getMappingKey(), MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + + id.getResourcePersistentAttribute().addAnnotation(JPA.ONE_TO_ONE); + assertEquals(id.getMappingKey(), MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertNotNull(id.getResourcePersistentAttribute().getAnnotation(JPA.ID)); + + id.getResourcePersistentAttribute().removeAnnotation(JPA.ONE_TO_ONE); + assertEquals(id.getMappingKey(), MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + + id.getResourcePersistentAttribute().addAnnotation(JPA.MANY_TO_ONE); + assertEquals(id.getMappingKey(), MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertNotNull(id.getResourcePersistentAttribute().getAnnotation(JPA.ID)); + + id.getResourcePersistentAttribute().removeAnnotation(JPA.MANY_TO_ONE); + assertEquals(id.getMappingKey(), MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + + id.getResourcePersistentAttribute().setPrimaryAnnotation(null, new String[0]); + assertEquals(id.getMappingKey(), MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentTypeTests.java index 86d0dfcade..192ba84ca5 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaPersistentTypeTests.java @@ -327,7 +327,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes assertFalse(attributes.hasNext()); - getJavaPersistentType().attributes().next().getResourcePersistentAttribute().setMappingAnnotation(TransientAnnotation.ANNOTATION_NAME); + getJavaPersistentType().attributes().next().getResourcePersistentAttribute().setPrimaryAnnotation(TransientAnnotation.ANNOTATION_NAME, new String[0]); attributes = getJavaPersistentType().attributes(); javaPersistentAttribute = attributes.next(); @@ -652,8 +652,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getMappingAnnotation()); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); + assertNotNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -667,8 +666,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNotNull(typeResource.getMappingAnnotation()); - assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation); + assertNotNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -682,8 +680,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getMappingAnnotation()); - assertNull(typeResource.getMappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)); assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -695,7 +692,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); + typeResource.setPrimaryAnnotation(EmbeddableAnnotation.ANNOTATION_NAME, new String[0]); assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } @@ -707,7 +704,7 @@ public class Generic2_0JavaPersistentTypeTests extends Generic2_0ContextModelTes assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(EntityAnnotation.ANNOTATION_NAME); + typeResource.setPrimaryAnnotation(EntityAnnotation.ANNOTATION_NAME, new String[0]); assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaSequenceGeneratorTests.java index ecdbfdd846..6db6580521 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaSequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/Generic2_0JavaSequenceGeneratorTests.java @@ -56,7 +56,7 @@ public class Generic2_0JavaSequenceGeneratorTests extends Generic2_0ContextModel assertNull(sequenceGenerator.getCatalog()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); annotation.setCatalog("testCatalog"); @@ -90,13 +90,13 @@ public class Generic2_0JavaSequenceGeneratorTests extends Generic2_0ContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals("testCatalog", annotation.getCatalog()); sequenceGenerator.setName(null); sequenceGenerator.setSpecifiedCatalog(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); } // ********** schema ********** @@ -111,7 +111,7 @@ public class Generic2_0JavaSequenceGeneratorTests extends Generic2_0ContextModel assertNull(sequenceGenerator.getSchema()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); annotation.setSchema("testSchema"); @@ -176,13 +176,13 @@ public class Generic2_0JavaSequenceGeneratorTests extends Generic2_0ContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation annotation = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals("testSchema", annotation.getSchema()); sequenceGenerator.setName(null); sequenceGenerator.setSpecifiedSchema(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR)); + assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR)); } // ********** utility ********** diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentAttributeTests.java index c875b6ee40..9356db88d0 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentAttributeTests.java @@ -28,7 +28,8 @@ import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @SuppressWarnings("nls") -public class Generic2_0OrmPersistentAttributeTests extends Generic2_0OrmContextModelTestCase +public class Generic2_0OrmPersistentAttributeTests + extends Generic2_0OrmContextModelTestCase { public Generic2_0OrmPersistentAttributeTests(String name) { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentTypeTests.java index e1f0b9d18a..5e28d3b1e5 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmPersistentTypeTests.java @@ -21,7 +21,8 @@ import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @SuppressWarnings("nls") -public class Generic2_0OrmPersistentTypeTests extends Generic2_0OrmContextModelTestCase +public class Generic2_0OrmPersistentTypeTests + extends Generic2_0OrmContextModelTestCase { public Generic2_0OrmPersistentTypeTests(String name) { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmSequenceGeneratorTests.java index c79ad4b2e1..eaf345e3e1 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmSequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/Generic2_0OrmSequenceGeneratorTests.java @@ -15,7 +15,8 @@ import org.eclipse.jpt.core.jpa2.resource.orm.XmlSequenceGenerator; /** * Generic2_0OrmSequenceGenerator2_0Tests */ -public class Generic2_0OrmSequenceGeneratorTests extends Generic2_0OrmContextModelTestCase +public class Generic2_0OrmSequenceGeneratorTests + extends Generic2_0OrmContextModelTestCase { public Generic2_0OrmSequenceGeneratorTests(String name) { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java index e60429a760..42b14d51c7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java @@ -71,7 +71,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAccessOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - Access2_0Annotation access = (Access2_0Annotation) typeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) typeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); assertEquals(AccessType.PROPERTY, access.getValue()); } @@ -80,13 +80,13 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - Access2_0Annotation access = (Access2_0Annotation) typeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) typeResource.getAnnotation(JPA.ACCESS); assertNull(access); - typeResource.addSupportingAnnotation(JPA.ACCESS); + typeResource.addAnnotation(JPA.ACCESS); assertSourceContains("@Access", cu); - access = (Access2_0Annotation) typeResource.getSupportingAnnotation(JPA.ACCESS); + access = (Access2_0Annotation) typeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); access.setValue(AccessType.FIELD); @@ -98,7 +98,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { assertSourceContains("@Access(PROPERTY)", cu); access.setValue(null); - assertNull(typeResource.getSupportingAnnotation(JPA.ACCESS)); + assertNull(typeResource.getAnnotation(JPA.ACCESS)); assertSourceDoesNotContain("@Access", cu); } @@ -107,7 +107,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.persistableFields().next(); - Access2_0Annotation access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); assertEquals(AccessType.FIELD, access.getValue()); } @@ -117,13 +117,13 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.persistableFields().next(); - Access2_0Annotation access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNull(access); - attributeResource.addSupportingAnnotation(JPA.ACCESS); + attributeResource.addAnnotation(JPA.ACCESS); assertSourceContains("@Access", cu); - access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); access.setValue(AccessType.FIELD); @@ -135,7 +135,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { assertSourceContains("@Access(PROPERTY)", cu); access.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.ACCESS)); + assertNull(attributeResource.getAnnotation(JPA.ACCESS)); assertSourceDoesNotContain("@Access", cu); } @@ -144,7 +144,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next(); - Access2_0Annotation access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); assertEquals(AccessType.PROPERTY, access.getValue()); } @@ -154,13 +154,13 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.persistableProperties().next(); - Access2_0Annotation access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + Access2_0Annotation access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNull(access); - attributeResource.addSupportingAnnotation(JPA.ACCESS); + attributeResource.addAnnotation(JPA.ACCESS); assertSourceContains("@Access", cu); - access = (Access2_0Annotation) attributeResource.getSupportingAnnotation(JPA.ACCESS); + access = (Access2_0Annotation) attributeResource.getAnnotation(JPA.ACCESS); assertNotNull(access); access.setValue(AccessType.FIELD); @@ -172,7 +172,7 @@ public class Access2_0AnnotationTests extends JavaResourceModel2_0TestCase { assertSourceContains("@Access(PROPERTY)", cu); access.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(JPA.ACCESS)); + assertNull(attributeResource.getAnnotation(JPA.ACCESS)); assertSourceDoesNotContain("@Access", cu); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java index 0eb554f273..91efc8051e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java @@ -153,7 +153,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -163,7 +163,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -177,7 +177,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -194,7 +194,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -204,7 +204,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0); @@ -218,7 +218,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -228,7 +228,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -246,7 +246,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -280,7 +280,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -306,7 +306,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -333,7 +333,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); @@ -350,7 +350,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { public void testGetNullJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNotNull(associationOverride); assertNull(joinTable); @@ -359,7 +359,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { public void testJoinTableGetName() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertEquals(JOIN_TABLE_NAME, joinTable.getName()); } @@ -367,7 +367,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { public void testJoinTableSetName() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertEquals(JOIN_TABLE_NAME, joinTable.getName()); @@ -383,7 +383,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { public void testAddJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNull(joinTable); @@ -396,7 +396,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { public void testRemoveJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNull(joinTable); } @@ -405,7 +405,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); @@ -415,7 +415,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); assertNull(table.getCatalog()); @@ -430,7 +430,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(CATALOG_NAME, table.getCatalog()); @@ -444,7 +444,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); @@ -454,7 +454,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); assertNull(table.getSchema()); @@ -469,7 +469,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(SCHEMA_NAME, table.getSchema()); @@ -483,7 +483,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(0, table.uniqueConstraintsSize()); @@ -493,7 +493,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -507,7 +507,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(3, table.uniqueConstraintsSize()); @@ -517,7 +517,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addUniqueConstraint(0).addColumnName("FOO"); @@ -535,7 +535,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next()); @@ -562,7 +562,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu); @@ -574,7 +574,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu); @@ -586,7 +586,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(0, table.joinColumnsSize()); @@ -596,7 +596,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -610,7 +610,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(2, table.joinColumnsSize()); @@ -620,7 +620,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addJoinColumn(0).setName("FOO"); @@ -637,7 +637,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addJoinColumn(0).setName("FOO"); @@ -667,7 +667,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -693,7 +693,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); @@ -722,7 +722,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(2, table.joinColumnsSize()); @@ -741,7 +741,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(0, table.inverseJoinColumnsSize()); @@ -751,7 +751,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -765,7 +765,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(2, table.inverseJoinColumnsSize()); @@ -775,7 +775,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(0).setName("FOO"); @@ -792,7 +792,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(2).setName("FOO"); @@ -823,7 +823,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(0).setName("FOO"); @@ -845,7 +845,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(1).setName("FOO"); @@ -867,7 +867,7 @@ public class AssociationOverride2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(2, table.inverseJoinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java index 6a1eef964b..f1d5b7acd9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java @@ -173,7 +173,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -184,7 +184,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -199,7 +199,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -215,46 +215,46 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testAddAssociationOverrideToBeginningOfList() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAZ"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"BAZ\"),@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertEquals("BAZ", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("FOO", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("BAR", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testRemoveAssociationOverrideCopyExisting() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertSourceContains("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))", cu); } @@ -263,7 +263,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -273,7 +273,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0); associationOverride.addJoinColumn(1); @@ -286,7 +286,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -296,7 +296,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -316,7 +316,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -350,7 +350,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -375,7 +375,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -401,7 +401,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); @@ -418,7 +418,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { public void testGetNullJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNotNull(associationOverride); @@ -428,7 +428,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { public void testJoinTableGetName() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertEquals(JOIN_TABLE_NAME, joinTable.getName()); @@ -437,7 +437,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { public void testJoinTableSetName() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertEquals(JOIN_TABLE_NAME, joinTable.getName()); @@ -454,7 +454,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { public void testAddJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNull(joinTable); @@ -468,7 +468,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { public void testRemoveJoinTable() throws Exception { ICompilationUnit cu = this.createTestAssociationOverrideOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation joinTable = associationOverride.getJoinTable(); assertNull(joinTable); @@ -478,7 +478,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); @@ -489,7 +489,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); @@ -505,7 +505,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(CATALOG_NAME, table.getCatalog()); @@ -520,7 +520,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); @@ -531,7 +531,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertNotNull(table); @@ -547,7 +547,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals(SCHEMA_NAME, table.getSchema()); @@ -562,7 +562,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -573,7 +573,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -588,7 +588,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -599,7 +599,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -618,7 +618,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next()); @@ -646,7 +646,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu); @@ -659,7 +659,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); assertSourceContains("@AssociationOverride(name = \"" + ASSOCIATION_OVERRIDE_NAME + "\", joinTable = @JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})}))", cu); @@ -672,7 +672,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -683,7 +683,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -698,7 +698,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -709,7 +709,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -727,7 +727,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addJoinColumn(0).setName("FOO"); @@ -758,7 +758,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); @@ -785,7 +785,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -815,7 +815,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -835,7 +835,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -846,7 +846,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -861,7 +861,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -872,7 +872,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); @@ -890,7 +890,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(2).setName("FOO"); @@ -922,7 +922,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(0).setName("FOO"); @@ -945,7 +945,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); table.addInverseJoinColumn(1).setName("FOO"); @@ -968,7 +968,7 @@ public class AssociationOverrides2_0Tests extends JavaResourceModel2_0TestCase { ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithInverseJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverride2_0Annotation associationOverride = (AssociationOverride2_0Annotation) associationOverrides.nestedAnnotations().next(); JoinTableAnnotation table = associationOverride.getJoinTable(); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0Tests.java index 1886e0266b..b241d8de96 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0Tests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0Tests.java @@ -45,7 +45,7 @@ public class SequenceGenerator2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_CATALOG, sequenceGenerator.getCatalog()); } @@ -54,7 +54,7 @@ public class SequenceGenerator2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_CATALOG, sequenceGenerator.getCatalog()); sequenceGenerator.setCatalog("foo"); @@ -75,7 +75,7 @@ public class SequenceGenerator2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SCHEMA, sequenceGenerator.getSchema()); } @@ -84,7 +84,7 @@ public class SequenceGenerator2_0Tests extends JavaResourceModel2_0TestCase { JavaResourcePersistentType typeResource = this.buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGenerator2_0Annotation sequenceGenerator = (SequenceGenerator2_0Annotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SCHEMA, sequenceGenerator.getSchema()); sequenceGenerator.setSchema("foo"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java index bc8f4efb69..c9162b778d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JpaPlatformTests.java @@ -17,6 +17,7 @@ import org.eclipse.jpt.core.MappingKeys; import org.eclipse.jpt.core.context.java.JavaAttributeMapping; import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; import org.eclipse.jpt.core.context.java.JavaTypeMapping; +import org.eclipse.jpt.core.context.java.JavaTypeMappingProvider; import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties; import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider; import org.eclipse.jpt.core.resource.java.JPA; @@ -99,12 +100,17 @@ public class JpaPlatformTests extends ContextModelTestCase public void testBuildJavaTypeMappingFromMappingKey() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - - JavaTypeMapping javaTypeMapping = getJpaProject().getJpaPlatform().buildJavaTypeMappingFromMappingKey(JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY, getJavaPersistentType()); - assertTrue(javaTypeMapping instanceof JavaTestTypeMapping); - javaTypeMapping = jpaPlatform().buildJavaTypeMappingFromMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType()); - assertTrue(javaTypeMapping instanceof TestJavaEntity); + JavaTypeMappingProvider mappingProvider = + jpaPlatform().getJavaTypeMappingProvider(JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY); + JavaTypeMapping mapping = + mappingProvider.buildMapping(getJavaPersistentType(), jpaPlatform().getJpaFactory()); + assertTrue(mapping instanceof JavaTestTypeMapping); + + mappingProvider = + jpaPlatform().getJavaTypeMappingProvider(MappingKeys.ENTITY_TYPE_MAPPING_KEY); + mapping = mappingProvider.buildMapping(getJavaPersistentType(), jpaPlatform().getJpaFactory()); + assertTrue(mapping instanceof TestJavaEntity); } public void testBuildJavaAttributeMappingFromMappingKey() throws Exception { @@ -123,5 +129,4 @@ public class JpaPlatformTests extends ContextModelTestCase getJavaPersistentType().getAttributeNamed("name"), jpaPlatform().getJpaFactory()); assertTrue(mapping instanceof TestJavaBasicMapping); } - } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java index d86c38e831..f3463c3301 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java @@ -57,7 +57,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -67,7 +67,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -81,7 +81,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -98,7 +98,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -108,7 +108,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0); @@ -122,7 +122,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -132,7 +132,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -150,7 +150,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -184,7 +184,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -210,7 +210,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -237,7 +237,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java index c7a207c3c5..9f1385dc63 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java @@ -76,7 +76,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -87,7 +87,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -102,7 +102,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -118,46 +118,46 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testAddAssociationOverrideToBeginningOfList() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAZ"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"BAZ\"),@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertEquals("BAZ", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("FOO", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertEquals("BAR", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testRemoveAssociationOverrideCopyExisting() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertSourceContains("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))", cu); } @@ -166,7 +166,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -176,7 +176,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0); associationOverride.addJoinColumn(1); @@ -189,7 +189,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -199,7 +199,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -219,7 +219,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -253,7 +253,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -278,7 +278,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -304,7 +304,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java index 2b62b55107..a3a8c701c3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java @@ -58,7 +58,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -68,7 +68,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); assertNull(column); @@ -78,7 +78,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -92,7 +92,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -107,7 +107,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); } @@ -116,7 +116,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); @@ -133,7 +133,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertNull(column); @@ -147,7 +147,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertNull(column); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java index 51b5418cc6..6ff234c926 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java @@ -77,7 +77,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); @@ -88,7 +88,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); @@ -99,7 +99,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); @@ -114,7 +114,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -130,7 +130,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); ColumnAnnotation column = attributeOverride.getColumn(); @@ -141,7 +141,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); ColumnAnnotation column = attributeOverride.getColumn(); @@ -160,46 +160,46 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testAddAttributeOverrideToBeginningOfList() throws Exception { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAZ\"),@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)), @AttributeOverride(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testRemoveAttributeOverrideCopyExisting() throws Exception { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverride(name = \"FOO\", column = @Column(name = \"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1))", cu); } //not sure i want to test this api, how can we keep ContainerAnnotation.add, move, remove from being public? diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java index f2077b9595..84e8fa4fd5 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java @@ -69,7 +69,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertNotNull(basic); } @@ -78,7 +78,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); } @@ -87,7 +87,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); basic.setOptional(Boolean.FALSE); @@ -101,7 +101,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); basic.setOptional(null); @@ -116,7 +116,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); } @@ -125,7 +125,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); basic.setFetch(FetchType.LAZY); @@ -139,7 +139,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); basic.setFetch(null); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java index f82a4966ea..5052b0ef37 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java @@ -110,7 +110,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -119,7 +119,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -134,7 +134,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -149,7 +149,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -163,7 +163,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -171,7 +171,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -190,7 +190,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -198,7 +198,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -217,7 +217,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUnique()); } @@ -226,7 +226,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -244,7 +244,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getNullable()); } @@ -253,7 +253,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -271,7 +271,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getInsertable()); } @@ -280,7 +280,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -298,7 +298,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUpdatable()); } @@ -307,7 +307,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUpdatable()); @@ -325,7 +325,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("length"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } @@ -334,7 +334,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -352,7 +352,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("precision"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getPrecision()); } @@ -361,7 +361,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertEquals(null, column.getPrecision()); @@ -379,7 +379,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("scale"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getScale()); } @@ -388,7 +388,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getScale()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java index 3ca4deeb88..38e47e8372 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java @@ -95,7 +95,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -103,7 +103,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetNull() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getDiscriminatorType()); @@ -113,7 +113,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -127,7 +127,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -140,14 +140,14 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -165,7 +165,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetLength() throws Exception { ICompilationUnit cu = this.createTestColumnWithIntElement("length"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } @@ -173,7 +173,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetLength() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -190,14 +190,14 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetDiscriminatorType() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithDiscriminatorType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(DiscriminatorType.CHAR, column.getDiscriminatorType()); } public void testSetDiscriminatorType() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNull(column.getDiscriminatorType()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java index c5beed484f..542961c712 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java @@ -53,7 +53,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); assertNotNull(discriminatorValue); } @@ -61,7 +61,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValueWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); assertEquals("discriminator", discriminatorValue.getValue()); } @@ -69,7 +69,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); discriminatorValue.setValue("foo"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java index 6ad9f3b0c8..e1b69a0feb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java @@ -56,7 +56,7 @@ public class EmbeddableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEmbeddable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); } @@ -64,10 +64,10 @@ public class EmbeddableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEmbeddableAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertNotNull(entity); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java index 42acc30c0c..bcd884dc17 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java @@ -43,7 +43,7 @@ public class EmbeddedIdTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddedIdAnnotation); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java index f34354a840..98117ca0a7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java @@ -43,7 +43,7 @@ public class EmbeddedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddedAnnotation); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java index 6297416b63..a958cbe45d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java @@ -71,7 +71,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertTrue(entity != null); assertEquals(ENTITY_NAME, entity.getName()); } @@ -80,7 +80,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertTrue(entity != null); assertNull(entity.getName()); } @@ -89,7 +89,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertNull(entity.getName()); entity.setName("Foo"); assertEquals("Foo", entity.getName()); @@ -101,7 +101,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertEquals(ENTITY_NAME, entity.getName()); entity.setName(null); @@ -115,10 +115,10 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclassAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getAnnotation(JPA.MAPPED_SUPERCLASS); assertNotNull(mappedSuperclass); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java index 919676c0f0..a17bf64a52 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java @@ -56,7 +56,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); assertNotNull(enumerated); } @@ -65,7 +65,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); assertEquals(EnumType.ORDINAL, enumerated.getValue()); } @@ -74,7 +74,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); enumerated.setValue(EnumType.STRING); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java index e65a912113..e32c0d03d7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java @@ -70,7 +70,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); } @@ -79,7 +79,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); } @@ -88,7 +88,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); generatedValue.setGenerator("foo"); @@ -108,7 +108,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy()); } @@ -117,7 +117,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy()); generatedValue.setStrategy(GenerationType.TABLE); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java index c6ce1260ff..af0079717e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java @@ -55,7 +55,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNotNull(idClass); assertNull(idClass.getValue()); } @@ -64,7 +64,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); } @@ -72,7 +72,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); idClass.setValue("foo"); @@ -84,7 +84,7 @@ public class IdClassTests extends JavaResourceModelTestCase { assertSourceDoesNotContain("@IdClass", cu); - idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNull(idClass); } @@ -92,7 +92,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNotNull(idClass.getValue()); assertEquals("MyClass", idClass.getFullyQualifiedClassName()); //bug 196200 changed this diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java index 3574e4d649..9dd3c413e9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java @@ -43,7 +43,7 @@ public class IdTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof IdAnnotation); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java index d3901a3956..a40770ca29 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java @@ -54,7 +54,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritance(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); assertNotNull(inheritance); } @@ -62,7 +62,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritanceWithStrategy(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); assertEquals(InheritanceType.JOINED, inheritance.getStrategy()); } @@ -70,7 +70,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritance(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); inheritance.setStrategy(InheritanceType.TABLE_PER_CLASS); assertSourceContains("@Inheritance(strategy = TABLE_PER_CLASS)", cu); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java index 1a8cb78a59..99e2328de6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java @@ -19,6 +19,7 @@ import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotati import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; import org.eclipse.jpt.core.resource.java.BasicAnnotation; import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; import org.eclipse.jpt.core.resource.java.IdAnnotation; import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.core.resource.java.JavaResourceNode; @@ -346,21 +347,21 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(1, attributeResource.annotationsSize()); } public void testJavaAttributeAnnotation() throws Exception { ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.COLUMN)); } public void testJavaAttributeAnnotationNull() throws Exception { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(attributeResource.getAnnotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first column found @@ -368,7 +369,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityMultipleColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("FOO", columnResource.getName()); } @@ -376,7 +377,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(JPA.COLUMN); + attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column", cu); } @@ -386,14 +387,14 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); columnResource.setTable(null); assertSourceContains("@Column(name = \"FOO\")", cu); columnResource.setName(null); assertSourceDoesNotContain("@Column", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } public void testMultipleAttributeMappings() throws Exception { @@ -401,19 +402,18 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(2, attributeResource.mappingAnnotationsSize()); - assertEquals(0, attributeResource.supportingAnnotationsSize()); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); - assertNotNull(attributeResource.getMappingAnnotation(JPA.ID)); + assertEquals(2, attributeResource.annotationsSize()); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.ID)); - JavaResourceNode javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode javaAttributeMappingAnnotation = attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME); assertTrue(javaAttributeMappingAnnotation instanceof BasicAnnotation); assertSourceContains("@Basic", cu); assertSourceContains("@Id", cu); - attributeResource.setMappingAnnotation(JPA.ONE_TO_MANY); - assertEquals(1, attributeResource.mappingAnnotationsSize()); - javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation(); + attributeResource.setPrimaryAnnotation(JPA.ONE_TO_MANY, new String[0]); + assertEquals(1, attributeResource.annotationsSize()); + javaAttributeMappingAnnotation = attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertTrue(javaAttributeMappingAnnotation instanceof OneToManyAnnotation); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@OneToMany", cu); @@ -424,10 +424,10 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, attributeResource.mappingAnnotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); - attributeResource.setMappingAnnotation(JPA.ID); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + attributeResource.setPrimaryAnnotation(JPA.ID, new String[0]); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); assertSourceContains("@Id", cu); } @@ -435,10 +435,10 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNull(attributeResource.getMappingAnnotation()); + assertEquals(1, attributeResource.annotationsSize()); - attributeResource.setMappingAnnotation(JPA.ID); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + attributeResource.setPrimaryAnnotation(JPA.ID, new String[] {ColumnAnnotation.ANNOTATION_NAME}); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); assertSourceContains("@Id", cu); assertSourceContains("@Column", cu); @@ -448,10 +448,14 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); - attributeResource.setMappingAnnotation(JPA.BASIC); - assertTrue(attributeResource.getMappingAnnotation() instanceof BasicAnnotation); + attributeResource.setPrimaryAnnotation( + JPA.BASIC, + new String[] { + ColumnAnnotation.ANNOTATION_NAME, + GeneratedValueAnnotation.ANNOTATION_NAME}); + assertTrue(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME) instanceof BasicAnnotation); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@GeneratedValue", cu); //not supported by Basic @@ -462,11 +466,15 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); - attributeResource.setMappingAnnotation(null); - assertNull(attributeResource.getMappingAnnotation()); + attributeResource.setPrimaryAnnotation( + null, + new String[] { + ColumnAnnotation.ANNOTATION_NAME, + GeneratedValueAnnotation.ANNOTATION_NAME}); + assertEquals(2, attributeResource.annotationsSize()); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@GeneratedValue", cu); //not supported by Basic assertSourceContains("@Column", cu); //common between Id and Basic @@ -479,7 +487,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceDoesNotContain("@Column", cu); - attributeResource.addSupportingAnnotation(JPA.COLUMN); + attributeResource.addAnnotation(JPA.COLUMN); assertSourceContains("@Column", cu); } @@ -488,7 +496,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceContains("@Column", cu); - attributeResource.removeSupportingAnnotation(JPA.COLUMN); + attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column", cu); } @@ -512,9 +520,9 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC } }); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); - assertNull(attributeResource.getMappingAnnotation(JPA.ID)); - assertNotNull(attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE)); + assertNotNull(attributeResource.getAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.ID)); + assertNotNull(attributeResource.getAnnotation(JPA.ONE_TO_ONE)); assertSourceContains("@Column", cu); } @@ -523,9 +531,9 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(1, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(1, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("FOO", attributeOverride.getName()); } @@ -535,7 +543,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsContainerNoNestable() throws Exception { @@ -543,18 +551,18 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsNestableAndContainer() throws Exception { ICompilationUnit cu = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("BAR", attributeOverrideResource.getName()); } @@ -563,7 +571,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertSourceContains("@AttributeOverride(name = \"FOO\")", cu); } @@ -575,13 +583,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"),@AttributeOverride(name = \"BAR\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } // @Embedded @@ -595,13 +603,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"),@AttributeOverride(name = \"BAR\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testAddJavaAttributeAnnotationNestableContainer5() throws Exception { @@ -609,13 +617,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"),@AttributeOverride(name = \"FOO\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } // @Embedded @@ -631,20 +639,20 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"BAZ\"),", cu); assertSourceContains("@AttributeOverride})", cu); attributeOverride.setName("BOO"); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - Iterator<NestableAnnotation> attributeOverrideAnnotations = attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + Iterator<NestableAnnotation> attributeOverrideAnnotations = attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); assertEquals("BAR", attributeOverride.getName()); attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); @@ -663,7 +671,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride", cu); } @@ -676,7 +684,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride", cu); assertSourceDoesNotContain("@AttributeOverrides", cu); @@ -687,7 +695,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride(name = \"FOO\"", cu); assertSourceContains("@AttributeOverride(name = \"BAR\"", cu); @@ -699,12 +707,12 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAZ\")})", cu); } @@ -713,13 +721,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.moveSupportingAnnotation(0, 2, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(0, 2, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAZ\"), @AttributeOverride(name = \"FOO\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAR\")})", cu); } @@ -729,12 +737,12 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAR\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"FOO\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); } @@ -815,11 +823,11 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC assertEquals(4, CollectionTools.size(typeResource.fields())); Iterator<JavaResourcePersistentAttribute> fields = typeResource.fields(); JavaResourcePersistentAttribute attributeResource = fields.next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("baz", column.getName()); attributeResource = fields.next(); - column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("baz", column.getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java index 1ff5585102..c9954be080 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; - import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddableAnnotation; @@ -438,33 +437,33 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testJavaTypeAnnotations() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(1, typeResource.supportingAnnotationsSize()); + assertEquals(2, typeResource.annotationsSize()); } public void testJavaTypeAnnotation() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.TABLE)); } public void testJavaTypeAnnotationNull() throws Exception { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first table found public void testDuplicateAnnotations() throws Exception { ICompilationUnit cu = this.createTestEntityMultipleTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableResource = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals("FOO", tableResource.getName()); } public void testRemoveTable() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(JPA.TABLE); + typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table", cu); } @@ -473,14 +472,14 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType jrpt = buildJavaTypeResource(cu); - TableAnnotation tableAnnotation = (TableAnnotation) jrpt.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) jrpt.getAnnotation(JPA.TABLE); tableAnnotation.setSchema(null); assertSourceContains("@Table(name = \"FOO\")", cu); tableAnnotation.setName(null); assertSourceDoesNotContain("@Table", cu); - assertNull(jrpt.getSupportingAnnotation(JPA.TABLE)); + assertNull(jrpt.getAnnotation(JPA.TABLE)); } public void testMultipleTypeMappings() throws Exception { @@ -488,19 +487,18 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(2, typeResource.mappingAnnotationsSize()); - assertEquals(0, typeResource.supportingAnnotationsSize()); - assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); - assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY)); + assertEquals(2, typeResource.annotationsSize()); + assertNotNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.ENTITY)); - JavaResourceNode javaTypeMappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode javaTypeMappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(javaTypeMappingAnnotation instanceof EmbeddableAnnotation); assertSourceContains("@Entity", cu); assertSourceContains("@Embeddable", cu); - typeResource.setMappingAnnotation(JPA.MAPPED_SUPERCLASS); - assertEquals(1, typeResource.mappingAnnotationsSize()); - javaTypeMappingAnnotation = typeResource.getMappingAnnotation(); + typeResource.setPrimaryAnnotation(JPA.MAPPED_SUPERCLASS, new String[0]); + assertEquals(1, typeResource.annotationsSize()); + javaTypeMappingAnnotation = typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME); assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclassAnnotation); assertSourceDoesNotContain("@Entity", cu); assertSourceContains("@MappedSuperclass", cu); @@ -510,31 +508,19 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testSetJavaTypeMappingAnnotation() throws Exception { ICompilationUnit cu = createTestType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, typeResource.mappingAnnotationsSize()); + assertEquals(0, typeResource.annotationsSize()); - typeResource.setMappingAnnotation(JPA.ENTITY); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); + typeResource.setPrimaryAnnotation(JPA.ENTITY, new String[0]); + assertTrue(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME) instanceof EntityAnnotation); assertSourceContains("@Entity", cu); } - public void testSetJavaTypeMappingAnnotation2() throws Exception { - ICompilationUnit cu = createTestEntityWithTable(); - JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); - - typeResource.setMappingAnnotation(JPA.EMBEDDABLE); - assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation); - - assertSourceDoesNotContain("@Entity", cu); - assertSourceContains("@Table", cu); - } - public void testAddJavaTypeAnnotation() throws Exception { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); assertSourceDoesNotContain("@Table", cu); - typeResource.addSupportingAnnotation(JPA.TABLE); + typeResource.addAnnotation(JPA.TABLE); assertSourceContains("@Table", cu); } @@ -543,7 +529,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); assertSourceContains("@Table", cu); - typeResource.removeSupportingAnnotation(JPA.TABLE); + typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table", cu); } @@ -566,9 +552,9 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { } }); - assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE)); - assertNull(typeResource.getMappingAnnotation(JPA.ENTITY)); - assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.ENTITY)); + assertNotNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); assertSourceContains("@Table", cu); } @@ -576,9 +562,9 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(1, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(1, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("FOO", secondaryTableResource.getName()); } @@ -587,25 +573,25 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsContainerNoNestable() throws Exception { ICompilationUnit cu = createTestEntityWithEmptySecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsNestableAndContainer() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("BAR", secondaryTableResource.getName()); } @@ -614,7 +600,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testAddJavaTypeAnnotationNestableContainer() throws Exception { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("FOO"); assertSourceContains("@SecondaryTable(name = \"FOO\")", cu); } @@ -625,13 +611,13 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"),@SecondaryTable(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } // @Entity @@ -644,45 +630,45 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"),@SecondaryTable(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddJavaTypeAnnotationNestableContainer5() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"),@SecondaryTable(name = \"FOO\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddJavaTypeAnnotationNestableContainer6() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"),@SecondaryTable(name = \"FOO\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"),@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"FOO\")})", cu); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } // @Entity @@ -697,19 +683,19 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable})", cu); secondaryTableResource.setName("BOO"); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - Iterator<NestableAnnotation> secondaryTableAnnotations = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> secondaryTableAnnotations = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); assertEquals("BAR", secondaryTableResource.getName()); secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); @@ -726,7 +712,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable", cu); } @@ -738,7 +724,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable", cu); assertSourceDoesNotContain("@SecondaryTables", cu); @@ -748,7 +734,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable(name = \"FOO\"", cu); assertSourceContains("@SecondaryTable(name = \"BAR\"", cu); @@ -759,11 +745,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ", cu); - typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAZ\")})", cu); } @@ -771,11 +757,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\")})", cu); - typeResource.moveSupportingAnnotation(0, 2, JPA.SECONDARY_TABLES); + typeResource.moveAnnotation(0, 2, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\")})", cu); } @@ -783,11 +769,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\")})", cu); - typeResource.moveSupportingAnnotation(2, 0, JPA.SECONDARY_TABLES); + typeResource.moveAnnotation(2, 0, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\")})", cu); } @@ -803,12 +789,12 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityDuplicates(); JavaResourcePersistentType persistentType = buildJavaTypeResource(cu); - EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getAnnotation(JPA.ENTITY); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); - assertEquals(1, persistentType.mappingAnnotationsSize()); + assertEquals(1, persistentType.annotationsSize()); - javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation(); + javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); } @@ -899,23 +885,23 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testAnnotatedMemberType() throws Exception { ICompilationUnit cu = this.createTestEntityWithMemberEmbeddable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY)); - assertNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.ENTITY)); + assertNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); JavaResourcePersistentType nestedType = typeResource.persistableTypes().next(); - assertNull(nestedType.getMappingAnnotation(JPA.ENTITY)); - assertNotNull(nestedType.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNull(nestedType.getAnnotation(JPA.ENTITY)); + assertNotNull(nestedType.getAnnotation(JPA.EMBEDDABLE)); } public void testInvalidAnnotations() throws Exception { ICompilationUnit cu = this.createTestInvalidAnnotations(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, typeResource.mappingAnnotationsSize()); - assertEquals(0, typeResource.supportingAnnotationsSize()); + assertEquals(0, typeResource.annotationsSize()); + assertEquals(0, typeResource.annotationsSize()); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, attributeResource.mappingAnnotationsSize()); - assertEquals(0, attributeResource.supportingAnnotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java index 7b5953c283..c17aff5f2d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java @@ -111,7 +111,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -120,7 +120,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -136,7 +136,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -151,7 +151,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -165,7 +165,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -173,7 +173,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -192,7 +192,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -200,7 +200,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -219,7 +219,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -227,7 +227,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -246,7 +246,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getUnique()); } @@ -255,7 +255,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -273,7 +273,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getNullable()); } @@ -282,7 +282,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -300,7 +300,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getInsertable()); } @@ -309,7 +309,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -327,7 +327,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getUpdatable()); } @@ -336,7 +336,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java index 8be5c3e571..6a489025f3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java @@ -127,7 +127,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -136,7 +136,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -151,7 +151,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -166,7 +166,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -180,7 +180,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -188,7 +188,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getTable()); @@ -207,7 +207,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -215,7 +215,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -234,7 +234,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -242,7 +242,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -261,7 +261,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUnique().booleanValue()); } @@ -270,7 +270,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUnique()); @@ -288,7 +288,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getNullable().booleanValue()); } @@ -297,7 +297,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getNullable()); @@ -315,7 +315,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getInsertable().booleanValue()); } @@ -324,7 +324,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getInsertable()); @@ -342,7 +342,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUpdatable().booleanValue()); } @@ -351,7 +351,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUpdatable()); @@ -372,13 +372,13 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.JOIN_COLUMNS)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); } public void testAddJoinColumnToBeginningOfList() throws Exception { @@ -386,22 +386,22 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAZ\"),@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"), @JoinColumn(name = \"FOO\")})", cu); - Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + Iterator<NestableAnnotation> joinColumns = attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); - assertNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.JOIN_COLUMNS)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); } @@ -410,11 +410,11 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name = \"FOO\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); assertSourceContains("@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\")", cu); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java index ef488c5f90..45acbd521e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java @@ -126,7 +126,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -136,7 +136,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -148,7 +148,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -163,7 +163,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -177,7 +177,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -187,7 +187,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -202,7 +202,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -216,7 +216,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -226,7 +226,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -241,7 +241,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -255,7 +255,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -265,7 +265,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0); @@ -279,7 +279,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -289,7 +289,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -307,7 +307,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next()); assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next()); @@ -334,7 +334,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); table.moveUniqueConstraint(2, 0); @@ -346,7 +346,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); table.moveUniqueConstraint(0, 2); @@ -358,7 +358,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.joinColumnsSize()); } @@ -368,7 +368,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0); @@ -382,7 +382,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.joinColumnsSize()); } @@ -392,7 +392,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); table.addJoinColumn(1); @@ -409,7 +409,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); assertEquals("FOO", table.joinColumnAt(0).getName()); @@ -439,7 +439,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -465,7 +465,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -494,7 +494,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.joinColumnsSize()); @@ -513,7 +513,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.inverseJoinColumnsSize()); } @@ -523,7 +523,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0); @@ -537,7 +537,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); } @@ -547,7 +547,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); table.addInverseJoinColumn(1); @@ -564,7 +564,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(2).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -595,7 +595,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -617,7 +617,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(1).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -639,7 +639,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java index 908fd5a763..7c003a3610 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java @@ -42,7 +42,7 @@ public class LobTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - LobAnnotation lob = (LobAnnotation) attributeResource.getSupportingAnnotation(JPA.LOB); + LobAnnotation lob = (LobAnnotation) attributeResource.getAnnotation(JPA.LOB); assertNotNull(lob); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java index 91e8b65994..5bbba87e4a 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java @@ -121,7 +121,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertNotNull(manyToMany); } @@ -130,7 +130,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); } @@ -139,7 +139,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); manyToMany.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); manyToMany.setFetch(null); @@ -168,7 +168,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); } @@ -177,7 +177,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); manyToMany.setTargetEntity("Foo"); @@ -190,7 +190,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); manyToMany.setTargetEntity(null); @@ -205,7 +205,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToMany.getFullyQualifiedTargetEntityClassName()); manyToMany.setTargetEntity("Foo"); @@ -222,7 +222,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); } @@ -231,7 +231,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(null, manyToMany.getMappedBy()); } @@ -240,7 +240,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertNull(manyToMany.getMappedBy()); manyToMany.setMappedBy("bar"); assertEquals("bar", manyToMany.getMappedBy()); @@ -253,7 +253,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); manyToMany.setMappedBy(null); @@ -268,7 +268,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeAll()); manyToMany.setCascadeAll(true); @@ -282,7 +282,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeMerge()); manyToMany.setCascadeMerge(true); @@ -296,7 +296,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadePersist()); manyToMany.setCascadePersist(true); @@ -310,7 +310,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRemove()); manyToMany.setCascadeRemove(true); @@ -324,7 +324,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRefresh()); manyToMany.setCascadeRefresh(true); @@ -338,7 +338,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeAll()); manyToMany.setCascadeAll(true); @@ -363,7 +363,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); manyToMany.setCascadeMerge(false); //TODO should the resource model handle this and remove both MERGE @@ -381,7 +381,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); assertTrue(manyToMany.isCascadeRemove()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java index d11ab1494c..e76703b1bb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java @@ -121,7 +121,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertNotNull(manyToOne); } @@ -130,7 +130,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); } @@ -139,7 +139,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); manyToOne.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); manyToOne.setFetch(null); @@ -169,7 +169,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); } @@ -178,7 +178,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); manyToOne.setTargetEntity("Foo"); @@ -191,7 +191,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); manyToOne.setTargetEntity(null); @@ -206,7 +206,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToOne.getFullyQualifiedTargetEntityClassName()); manyToOne.setTargetEntity("Foo"); @@ -223,7 +223,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); } @@ -232,7 +232,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); manyToOne.setOptional(Boolean.FALSE); @@ -246,7 +246,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); manyToOne.setOptional(null); @@ -261,7 +261,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeAll()); manyToOne.setCascadeAll(true); @@ -275,7 +275,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeMerge()); manyToOne.setCascadeMerge(true); @@ -289,7 +289,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadePersist()); manyToOne.setCascadePersist(true); @@ -303,7 +303,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRemove()); manyToOne.setCascadeRemove(true); @@ -317,7 +317,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRefresh()); manyToOne.setCascadeRefresh(true); @@ -331,7 +331,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeAll()); manyToOne.setCascadeAll(true); @@ -356,7 +356,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); manyToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -374,7 +374,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); assertTrue(manyToOne.isCascadeRemove()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java index 409de12160..0f3db8e7c4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java @@ -55,7 +55,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); assertNotNull(mapKey); } @@ -64,7 +64,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); assertEquals("key", mapKey.getName()); } @@ -73,7 +73,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); mapKey.setName("foo"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java index 5f20d3d322..726906a3f6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java @@ -56,7 +56,7 @@ public class MappedSuperclassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof MappedSuperclassAnnotation); } @@ -64,10 +64,10 @@ public class MappedSuperclassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclassAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getAnnotation(JPA.MAPPED_SUPERCLASS); assertNotNull(mappedSuperclass); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java index 274a1b6a25..b18a3bed9e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java @@ -114,7 +114,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } @@ -123,7 +123,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -132,7 +132,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -151,7 +151,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -160,7 +160,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -179,7 +179,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } @@ -188,7 +188,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); @@ -207,7 +207,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery.getResultClass()); assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this @@ -222,7 +222,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } @@ -231,7 +231,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); @@ -250,7 +250,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); @@ -260,7 +260,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); @@ -273,7 +273,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); @@ -283,7 +283,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); @@ -300,7 +300,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -330,7 +330,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -353,7 +353,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -376,46 +376,46 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); } public void testAddNamedNativeQueryToBeginningOfList() throws Exception { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu); - namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAZ"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"BAZ\"),@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"), @NamedNativeQuery(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + Iterator<NestableAnnotation> namedQueries = typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); assertEquals("BAZ", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); assertEquals("foo", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); assertEquals("BAR", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); } public void testRemoveNamedNativeQueryCopyExisting() throws Exception { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + typeResource.removeAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); assertSourceContains("@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\")", cu); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java index 79b0fe3d3b..d417de0445 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java @@ -97,7 +97,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery); } @@ -105,7 +105,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -113,7 +113,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -131,7 +131,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -139,7 +139,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -157,7 +157,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } @@ -165,7 +165,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); namedQuery.setResultClass("foo"); @@ -183,7 +183,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery.getResultClass()); assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this @@ -197,7 +197,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } @@ -205,7 +205,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); namedQuery.setResultSetMapping("foo"); @@ -223,7 +223,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(0, namedQuery.hintsSize()); } @@ -232,7 +232,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -244,7 +244,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(2, namedQuery.hintsSize()); } @@ -254,7 +254,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -270,7 +270,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -299,7 +299,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); @@ -321,7 +321,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java index 20796246b3..103cbe30d4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java @@ -95,7 +95,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } @@ -104,7 +104,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -113,7 +113,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -132,7 +132,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -141,7 +141,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -160,7 +160,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); @@ -170,7 +170,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); @@ -183,7 +183,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); @@ -193,7 +193,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); @@ -211,7 +211,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -240,7 +240,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -262,7 +262,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -284,47 +284,47 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_QUERIES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); } public void testAddNamedQueryToBeginningOfList() throws Exception { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu); - namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAZ"); assertSourceContains("@NamedQueries({@NamedQuery(name = \"BAZ\"),@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")), @NamedQuery(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + Iterator<NestableAnnotation> namedQueries = typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES); assertEquals("BAZ", ((NamedQueryAnnotation) namedQueries.next()).getName()); assertEquals("foo", ((NamedQueryAnnotation) namedQueries.next()).getName()); assertEquals("BAR", ((NamedQueryAnnotation) namedQueries.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_QUERIES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); } public void testRemoveNamedQueryCopyExisting() throws Exception { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\")),@NamedQuery(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + typeResource.removeAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); assertSourceContains("@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"))", cu); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java index 520c3c6425..254a62d4f1 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java @@ -79,7 +79,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertNotNull(namedQuery); } @@ -87,7 +87,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -95,7 +95,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -113,7 +113,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -121,7 +121,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -139,7 +139,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(0, namedQuery.hintsSize()); } @@ -148,7 +148,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -160,7 +160,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(2, namedQuery.hintsSize()); @@ -173,7 +173,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -190,7 +190,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -218,7 +218,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -239,7 +239,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java index 3040f80089..3b529fee48 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java @@ -121,7 +121,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertNotNull(oneToMany); } @@ -130,7 +130,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); } @@ -139,7 +139,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); oneToMany.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); oneToMany.setFetch(null); @@ -169,7 +169,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); } @@ -178,7 +178,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); oneToMany.setTargetEntity("Foo"); @@ -191,7 +191,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); oneToMany.setTargetEntity(null); @@ -206,7 +206,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToMany.getFullyQualifiedTargetEntityClassName()); oneToMany.setTargetEntity("Foo"); @@ -223,7 +223,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); } @@ -233,7 +233,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(null, oneToMany.getMappedBy()); } @@ -242,7 +242,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertNull(oneToMany.getMappedBy()); oneToMany.setMappedBy("bar"); assertEquals("bar", oneToMany.getMappedBy()); @@ -255,7 +255,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); oneToMany.setMappedBy(null); @@ -270,7 +270,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeAll()); oneToMany.setCascadeAll(true); @@ -284,7 +284,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeMerge()); oneToMany.setCascadeMerge(true); @@ -298,7 +298,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadePersist()); oneToMany.setCascadePersist(true); @@ -312,7 +312,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRemove()); oneToMany.setCascadeRemove(true); @@ -326,7 +326,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRefresh()); oneToMany.setCascadeRefresh(true); @@ -340,7 +340,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeAll()); oneToMany.setCascadeAll(true); @@ -365,7 +365,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); oneToMany.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -383,7 +383,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); assertTrue(oneToMany.isCascadeRemove()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java index 681f49478e..0997797956 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java @@ -134,7 +134,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertNotNull(oneToOne); } @@ -143,7 +143,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); } @@ -152,7 +152,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); oneToOne.setFetch(FetchType.LAZY); @@ -166,7 +166,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); oneToOne.setFetch(null); @@ -182,7 +182,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); } @@ -191,7 +191,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); oneToOne.setTargetEntity("Foo"); @@ -204,7 +204,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); oneToOne.setTargetEntity(null); @@ -219,7 +219,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToOne.getFullyQualifiedTargetEntityClassName()); oneToOne.setTargetEntity("Foo"); @@ -236,7 +236,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); } @@ -245,7 +245,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); oneToOne.setOptional(Boolean.FALSE); @@ -259,7 +259,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); oneToOne.setOptional(null); @@ -274,7 +274,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); } @@ -283,7 +283,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(null, oneToOne.getMappedBy()); } @@ -292,7 +292,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertNull(oneToOne.getMappedBy()); oneToOne.setMappedBy("bar"); assertEquals("bar", oneToOne.getMappedBy()); @@ -305,7 +305,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); oneToOne.setMappedBy(null); @@ -320,7 +320,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeAll()); oneToOne.setCascadeAll(true); @@ -334,7 +334,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeMerge()); oneToOne.setCascadeMerge(true); @@ -348,7 +348,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadePersist()); oneToOne.setCascadePersist(true); @@ -362,7 +362,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRemove()); oneToOne.setCascadeRemove(true); @@ -376,7 +376,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRefresh()); oneToOne.setCascadeRefresh(true); @@ -390,7 +390,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeAll()); oneToOne.setCascadeAll(true); @@ -415,7 +415,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); oneToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -433,7 +433,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); assertTrue(oneToOne.isCascadeRemove()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java index 55120e4a94..d403160318 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java @@ -55,7 +55,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); assertNotNull(orderBy); } @@ -64,7 +64,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); assertEquals("key", orderBy.getValue()); } @@ -73,7 +73,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); orderBy.setValue("foo"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java index 025e347a3f..42177540e2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java @@ -84,7 +84,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -93,7 +93,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); assertNull(column.getColumnDefinition()); @@ -103,7 +103,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -118,7 +118,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -134,7 +134,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -142,7 +142,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -161,7 +161,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -169,7 +169,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java index 1e01f24d38..74f08302f7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java @@ -100,7 +100,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -109,7 +109,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); assertNull(column.getReferencedColumnName()); @@ -120,7 +120,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -135,7 +135,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -149,7 +149,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -157,7 +157,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -176,7 +176,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -184,7 +184,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -205,35 +205,35 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); } public void testAddPrimaryKeyJoinColumnToBeginningOfList() throws Exception { ICompilationUnit cu = createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu); - joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("BAZ"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAZ\"),@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"), @PrimaryKeyJoinColumn(name = \"FOO\")})", cu); - Iterator<NestableAnnotation> pkJoinColumns = attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + Iterator<NestableAnnotation> pkJoinColumns = attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); - assertNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); } public void testRemovePrimaryKeyJoinColumnCopyExisting() throws Exception { @@ -241,11 +241,11 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name = \"FOO\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.removeAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); assertSourceContains("@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")", cu); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java index b522972feb..1a61a2a98b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java @@ -44,7 +44,7 @@ public class QueryHintTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); } @@ -53,7 +53,7 @@ public class QueryHintTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java index 357596a1f6..3ed657cfde 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java @@ -111,7 +111,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -120,7 +120,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -131,7 +131,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -145,7 +145,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -158,7 +158,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -167,7 +167,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -181,7 +181,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -194,7 +194,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -203,7 +203,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -217,7 +217,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -230,7 +230,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -238,7 +238,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -249,7 +249,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -257,7 +257,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -273,7 +273,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.removeUniqueConstraint(1); Iterator<UniqueConstraintAnnotation> uniqueConstraints = table.uniqueConstraints(); @@ -297,7 +297,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -315,7 +315,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -334,7 +334,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(0, table.pkJoinColumnsSize()); } @@ -342,7 +342,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -353,7 +353,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); } @@ -361,7 +361,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testAddPkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0).setName("FOO"); @@ -379,7 +379,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.removePkJoinColumn(1); assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"BAZ\")})", cu); @@ -395,7 +395,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); @@ -406,7 +406,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); @@ -419,7 +419,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java index 278f0f0f75..1cc9a47435 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java @@ -129,9 +129,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNull(table); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); assertNotNull(secondaryTables); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); @@ -142,7 +142,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getName()); assertNull(secondaryTable.getCatalog()); @@ -153,7 +153,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getName()); @@ -168,7 +168,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(TABLE_NAME, secondaryTable.getName()); @@ -182,7 +182,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); } @@ -191,7 +191,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getCatalog()); @@ -205,7 +205,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); @@ -219,7 +219,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNotNull(secondaryTable); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); @@ -229,7 +229,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getSchema()); @@ -243,7 +243,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); @@ -257,7 +257,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(0, secondaryTable.uniqueConstraintsSize()); @@ -266,7 +266,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0); @@ -278,7 +278,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(2, secondaryTable.uniqueConstraintsSize()); @@ -287,7 +287,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -304,7 +304,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -321,7 +321,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -339,7 +339,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -361,46 +361,46 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddSecondaryTable() throws Exception { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"),@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")), @SecondaryTable(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> secondaryTables = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testRemoveSecondaryTableCopyExisting() throws Exception { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\"))", cu); } @@ -408,7 +408,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(0, table.pkJoinColumnsSize()); } @@ -416,7 +416,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -427,7 +427,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); } @@ -435,7 +435,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testAddPkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0).setName("FOO"); table.addPkJoinColumn(1); @@ -447,7 +447,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.removePkJoinColumn(1); assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"BAZ\")}))", cu); @@ -462,7 +462,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); @@ -473,7 +473,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); @@ -486,7 +486,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java index bf2c26bbb0..d660df6c06 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java @@ -103,7 +103,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } @@ -111,7 +111,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSequenceGeneratorOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } @@ -120,7 +120,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); } @@ -129,7 +129,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); sequenceGenerator.setName("foo"); @@ -148,7 +148,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); } @@ -157,7 +157,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); sequenceGenerator.setSequenceName("foo"); @@ -176,7 +176,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); } @@ -185,7 +185,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); sequenceGenerator.setAllocationSize(Integer.valueOf(500)); @@ -206,7 +206,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue()); } @@ -215,7 +215,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue()); sequenceGenerator.setInitialValue(Integer.valueOf(500)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java index c4067dec1c..f5c5f04816 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java @@ -139,7 +139,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } @@ -147,7 +147,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableGeneratorOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.getAnnotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } @@ -156,7 +156,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); } @@ -165,7 +165,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); tableGenerator.setName("foo"); @@ -184,7 +184,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); } @@ -193,7 +193,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); tableGenerator.setTable("foo"); @@ -212,7 +212,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); } @@ -221,7 +221,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); tableGenerator.setCatalog("foo"); @@ -240,7 +240,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); } @@ -249,7 +249,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); tableGenerator.setSchema("foo"); @@ -268,7 +268,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); } @@ -277,7 +277,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); tableGenerator.setPkColumnName("foo"); @@ -296,7 +296,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); } @@ -305,7 +305,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); tableGenerator.setValueColumnName("foo"); @@ -324,7 +324,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); } @@ -333,7 +333,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); tableGenerator.setPkColumnValue("foo"); @@ -352,7 +352,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); } @@ -361,7 +361,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); tableGenerator.setAllocationSize(Integer.valueOf(500)); @@ -382,7 +382,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); } @@ -391,7 +391,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); tableGenerator.setInitialValue(Integer.valueOf(500)); @@ -412,7 +412,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(0, tableGenerator.uniqueConstraintsSize()); } @@ -422,7 +422,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0); tableGenerator.addUniqueConstraint(1); @@ -435,7 +435,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(3, tableGenerator.uniqueConstraintsSize()); } @@ -445,7 +445,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0).addColumnName("FOO"); tableGenerator.addUniqueConstraint(1); @@ -464,7 +464,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.removeUniqueConstraint(1); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); @@ -481,7 +481,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(2, 0); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu); @@ -492,7 +492,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(0, 2); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java index a2cf4d9c83..2fce6fb645 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java @@ -97,7 +97,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -106,7 +106,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -117,7 +117,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); @@ -131,7 +131,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -144,7 +144,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -153,7 +153,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -167,7 +167,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -180,7 +180,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -189,7 +189,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -203,7 +203,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -215,7 +215,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -223,7 +223,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -234,7 +234,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -242,7 +242,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -258,7 +258,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(0); @@ -275,7 +275,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.removeUniqueConstraint(1); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); @@ -290,7 +290,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -309,7 +309,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint3() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -328,7 +328,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.moveUniqueConstraint(2, 0); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu); @@ -337,7 +337,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.moveUniqueConstraint(0, 2); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java index 0769884ced..a75771b225 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java @@ -56,7 +56,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); assertNotNull(temporal); } @@ -65,7 +65,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); assertEquals(TemporalType.DATE, temporal.getValue()); } @@ -74,7 +74,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); temporal.setValue(TemporalType.TIME); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java index e268318116..d12522fd48 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java @@ -43,7 +43,7 @@ public class TransientTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof TransientAnnotation); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java index 5abf709599..82e5288290 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java @@ -43,7 +43,7 @@ public class VersionTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof VersionAnnotation); } } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java index 2063f56956..7e271ccbec 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java @@ -122,7 +122,7 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next(); BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); @@ -154,12 +154,12 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); basicMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetConvertUpdatesFromResourceModelChange() throws Exception { @@ -174,13 +174,13 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); convert.setValue("foo"); assertEquals(EclipseLinkConvert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType()); assertEquals("foo", ((EclipseLinkConvert) basicMapping.getConverter()).getConverterName()); - attributeResource.removeSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType()); assertFalse(basicMapping.isDefault()); @@ -198,7 +198,7 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); mutableAnnotation.setValue(Boolean.TRUE); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); @@ -209,10 +209,10 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes mutableAnnotation.setValue(Boolean.FALSE); assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable()); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutable.getSpecifiedMutable()); - attributeResource.addSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); } @@ -227,18 +227,18 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(null); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation); mutable.setSpecifiedMutable(Boolean.FALSE); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -256,7 +256,7 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.FALSE); @@ -278,7 +278,7 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertFalse(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -306,7 +306,7 @@ public class EclipseLinkJavaBasicMappingTests extends EclipseLinkContextModelTes JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java index 8dcc2456e5..9846f8e641 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java @@ -62,7 +62,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.FALSE, cacheAnnotation.getShared()); } @@ -108,7 +108,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.FALSE, cacheAnnotation.getShared()); assertNull(cacheAnnotation.getExpiryTimeOfDay()); @@ -124,7 +124,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(true, caching.isShared()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setShared(Boolean.FALSE); assertEquals(Boolean.FALSE, cacheAnnotation.getShared()); @@ -149,7 +149,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK, cacheAnnotation.getType()); @@ -174,7 +174,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getType()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setType(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheType.HARD_WEAK, cacheAnnotation.getType()); @@ -199,7 +199,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.FALSE, cacheAnnotation.getAlwaysRefresh()); } @@ -214,7 +214,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(false, caching.isAlwaysRefresh()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setAlwaysRefresh(Boolean.TRUE); assertEquals(Boolean.TRUE, cacheAnnotation.getAlwaysRefresh()); @@ -239,7 +239,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cacheAnnotation.getRefreshOnlyIfNewer()); } @@ -254,7 +254,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(false, caching.isRefreshOnlyIfNewer()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setRefreshOnlyIfNewer(Boolean.TRUE); assertEquals(Boolean.TRUE, cacheAnnotation.getRefreshOnlyIfNewer()); @@ -279,7 +279,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cacheAnnotation.getDisableHits()); } @@ -294,7 +294,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(false, caching.isDisableHits()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setDisableHits(Boolean.TRUE); assertEquals(Boolean.TRUE, cacheAnnotation.getDisableHits()); @@ -319,7 +319,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cacheAnnotation.getCoordinationType()); @@ -344,7 +344,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setCoordinationType(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cacheAnnotation.getCoordinationType()); @@ -362,10 +362,10 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(false, caching.hasExistenceChecking()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.addSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + typeResource.addAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertEquals(true, caching.hasExistenceChecking()); - typeResource.removeSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + typeResource.removeAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertEquals(false, caching.hasExistenceChecking()); } @@ -378,12 +378,12 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); assertEquals(false, caching.hasExistenceChecking()); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING)); caching.setExistenceChecking(true); assertEquals(true, caching.hasExistenceChecking()); - assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING)); + assertNotNull(typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING)); } public void testGetDefaultExistenceType() throws Exception { @@ -409,7 +409,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(EclipseLinkExistenceType.CHECK_DATABASE, caching.getExistenceType()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkExistenceCheckingAnnotation existenceCheckingAnnotation = (EclipseLinkExistenceCheckingAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + EclipseLinkExistenceCheckingAnnotation existenceCheckingAnnotation = (EclipseLinkExistenceCheckingAnnotation) typeResource.addAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); existenceCheckingAnnotation.setValue(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE, existenceCheckingAnnotation.getValue()); @@ -435,7 +435,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkExistenceCheckingAnnotation existenceCheckingAnnotation = (EclipseLinkExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + EclipseLinkExistenceCheckingAnnotation existenceCheckingAnnotation = (EclipseLinkExistenceCheckingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType.ASSUME_NON_EXISTENCE, existenceCheckingAnnotation.getValue()); @@ -459,14 +459,14 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertNull(entity.getCaching().getExpiry()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); assertNull(entity.getCaching().getExpiry()); cacheAnnotation.setExpiry(Integer.valueOf(57)); assertEquals(Integer.valueOf(57), entity.getCaching().getExpiry()); - typeResource.removeSupportingAnnotation(EclipseLinkJPA.CACHE); + typeResource.removeAnnotation(EclipseLinkJPA.CACHE); assertNull(entity.getCaching().getExpiry()); } @@ -480,12 +480,12 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); caching.setExpiry(Integer.valueOf(58)); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(58), cacheAnnotation.getExpiry()); caching.setExpiry(null); - cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertNull(cacheAnnotation); } @@ -500,7 +500,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase caching.addExpiryTimeOfDay(); caching.getExpiryTimeOfDay().setHour(Integer.valueOf(5)); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(5), cacheAnnotation.getExpiryTimeOfDay().getHour()); caching.setExpiry(Integer.valueOf(900)); @@ -521,7 +521,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertNull(caching.getExpiryTimeOfDay()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.addExpiryTimeOfDay(); @@ -541,7 +541,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase EclipseLinkExpiryTimeOfDay timeOfDayExpiry = caching.addExpiryTimeOfDay(); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertNotNull(cacheAnnotation.getExpiryTimeOfDay()); assertNotNull(caching.getExpiryTimeOfDay()); assertEquals(timeOfDayExpiry, caching.getExpiryTimeOfDay()); @@ -557,14 +557,14 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertNull(caching.getExpiryTimeOfDay()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.addExpiryTimeOfDay(); assertNotNull(caching.getExpiryTimeOfDay()); caching.removeExpiryTimeOfDay(); assertNull(caching.getExpiryTimeOfDay()); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CACHE)); } public void testAddTimeOfDayExpiryUnsetsExpiry() throws Exception { @@ -576,7 +576,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); caching.setExpiry(Integer.valueOf(800)); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(800), cacheAnnotation.getExpiry()); @@ -606,7 +606,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(new Integer(50), cacheAnnotation.getSize()); } @@ -621,7 +621,7 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase assertEquals(100, caching.getSize()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cacheAnnotation = (EclipseLinkCacheAnnotation) typeResource.addAnnotation(EclipseLinkJPA.CACHE); cacheAnnotation.setSize(new Integer(50)); assertEquals(new Integer(50), cacheAnnotation.getSize()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java index a5186b53f7..4855665dcc 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java @@ -97,7 +97,7 @@ public class EclipseLinkJavaConvertTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next(); BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); @@ -133,12 +133,12 @@ public class EclipseLinkJavaConvertTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConvertAnnotation convertAnnotation = (EclipseLinkConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + EclipseLinkConvertAnnotation convertAnnotation = (EclipseLinkConvertAnnotation) attributeResource.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertEquals("foo", convertAnnotation.getValue()); eclipseLinkConvert.setSpecifiedConverterName(null); - convertAnnotation = (EclipseLinkConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + convertAnnotation = (EclipseLinkConvertAnnotation) attributeResource.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertNotNull(convertAnnotation); assertEquals(null, convertAnnotation.getValue()); } @@ -155,13 +155,13 @@ public class EclipseLinkJavaConvertTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); convert.setValue("foo"); assertEquals(EclipseLinkConvert.ECLIPSE_LINK_CONVERTER, basicMapping.getConverter().getType()); assertEquals("foo", ((EclipseLinkConvert) basicMapping.getConverter()).getConverterName()); - attributeResource.removeSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, basicMapping.getConverter().getType()); assertFalse(basicMapping.isDefault()); @@ -195,26 +195,26 @@ public class EclipseLinkJavaConvertTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); eclipseLinkConvert.setConverter(EclipseLinkConverter.STRUCT_CONVERTER); assertEquals(EclipseLinkConverter.STRUCT_CONVERTER, eclipseLinkConvert.getConverter().getType()); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); eclipseLinkConvert.setConverter(EclipseLinkConverter.NO_CONVERTER); assertEquals(null, eclipseLinkConvert.getConverter()); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME)); eclipseLinkConvert.setConverter(EclipseLinkConverter.STRUCT_CONVERTER); assertEquals(EclipseLinkConverter.STRUCT_CONVERTER, eclipseLinkConvert.getConverter().getType()); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); basicMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME)); } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java index 6ed17d1318..338cbe03ea 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java @@ -98,19 +98,19 @@ public class EclipseLinkJavaConverterTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); converter.setName(null); assertEquals(null, converter.getName()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getName()); converter.setName("bar"); assertEquals("bar", converter.getName()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); } @@ -127,14 +127,14 @@ public class EclipseLinkJavaConverterTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setName("bar"); assertEquals("bar", converter.getName()); - attributeResource.removeSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.addAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setName("FOO"); @@ -169,19 +169,19 @@ public class EclipseLinkJavaConverterTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getConverterClass()); converter.setConverterClass(null); assertEquals(null, converter.getConverterClass()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getConverterClass()); converter.setConverterClass("Bar"); assertEquals("Bar", converter.getConverterClass()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getConverterClass()); } @@ -198,14 +198,14 @@ public class EclipseLinkJavaConverterTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + EclipseLinkConverterAnnotation converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setConverterClass("Bar"); assertEquals("Bar", converter.getConverterClass()); - attributeResource.removeSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkConverterAnnotation) attributeResource.addAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setConverterClass("FooBar"); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java index e1a0c4dd41..1aa781646b 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java @@ -81,19 +81,19 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); customizer.setSpecifiedCustomizerClass(null); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizerAnnotation); customizer.setSpecifiedCustomizerClass("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); } @@ -106,14 +106,14 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC assertEquals("Foo", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); customizerAnnotation.setValue("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - typeResource.removeSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); customizerAnnotation.setValue("FooBar"); @@ -127,7 +127,7 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC EclipseLinkEmbeddable embeddable = (EclipseLinkEmbeddable) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = embeddable.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -183,7 +183,7 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC // remove annotation, text context - typeResource.removeSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertNull(resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getType()); @@ -198,7 +198,7 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC EclipseLinkEmbeddable embeddable = (EclipseLinkEmbeddable) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = embeddable.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -237,13 +237,13 @@ public class EclipseLinkJavaEmbeddableTests extends EclipseLinkContextModelTestC contextChangeTracking.setSpecifiedType(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); assertNull(contextChangeTracking.getSpecifiedType()); // change context to AUTO specifically (this time from no annotation), test resource contextChangeTracking.setSpecifiedType(EclipseLinkChangeTrackingType.AUTO); - resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java index 4573801a85..eede0e57f0 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java @@ -96,19 +96,19 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); customizer.setSpecifiedCustomizerClass(null); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizerAnnotation); customizer.setSpecifiedCustomizerClass("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); } @@ -121,14 +121,14 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase assertEquals("Foo", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); customizerAnnotation.setValue("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - typeResource.removeSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); customizerAnnotation.setValue("FooBar"); @@ -142,7 +142,7 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase EclipseLinkEntity entity = (EclipseLinkEntity) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = entity.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -198,7 +198,7 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase // remove annotation, text context - typeResource.removeSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertNull(resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getType()); @@ -213,7 +213,7 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase EclipseLinkEntity entity = (EclipseLinkEntity) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = entity.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -252,13 +252,13 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase contextChangeTracking.setSpecifiedType(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); assertNull(contextChangeTracking.getSpecifiedType()); // change context to AUTO specifically (this time from no annotation), test resource contextChangeTracking.setSpecifiedType(EclipseLinkChangeTrackingType.AUTO); - resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType()); @@ -303,15 +303,15 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase readOnly.setSpecifiedReadOnly(Boolean.FALSE); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model readOnly.setSpecifiedReadOnly(Boolean.TRUE); - assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly()); readOnly.setSpecifiedReadOnly(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model } @@ -325,12 +325,12 @@ public class EclipseLinkJavaEntityTests extends EclipseLinkContextModelTestCase JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.removeSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); assertEquals(null, readOnly.getSpecifiedReadOnly()); assertEquals(false, readOnly.isDefaultReadOnly()); - typeResource.addSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); + typeResource.addAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly()); } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java index b8c075c7d6..20597cb49c 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java @@ -123,7 +123,7 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next(); IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); @@ -155,12 +155,12 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); idMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetConvertUpdatesFromResourceModelChange() throws Exception { @@ -175,13 +175,13 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); convert.setValue("foo"); assertEquals(EclipseLinkConvert.ECLIPSE_LINK_CONVERTER, idMapping.getConverter().getType()); assertEquals("foo", ((EclipseLinkConvert) idMapping.getConverter()).getConverterName()); - attributeResource.removeSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, idMapping.getConverter().getType()); assertFalse(idMapping.isDefault()); @@ -199,7 +199,7 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); mutableAnnotation.setValue(Boolean.TRUE); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); @@ -210,10 +210,10 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa mutableAnnotation.setValue(Boolean.FALSE); assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable()); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutable.getSpecifiedMutable()); - attributeResource.addSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); } @@ -228,18 +228,18 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(null); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation); mutable.setSpecifiedMutable(Boolean.FALSE); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -257,7 +257,7 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.FALSE); @@ -279,7 +279,7 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertFalse(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -307,7 +307,7 @@ public class EclipseLinkJavaIdMappingTests extends EclipseLinkContextModelTestCa JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java index 623481a083..b30a700f16 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java @@ -61,7 +61,7 @@ public class EclipseLinkJavaManyToManyMappingTests extends EclipseLinkContextMod EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -91,7 +91,7 @@ public class EclipseLinkJavaManyToManyMappingTests extends EclipseLinkContextMod // remove annotation, text context - attributeResource.removeSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertNull(joinFetchAnnotation.getValue()); assertNull(contextJoinFetch.getValue()); @@ -106,7 +106,7 @@ public class EclipseLinkJavaManyToManyMappingTests extends EclipseLinkContextMod EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -131,13 +131,13 @@ public class EclipseLinkJavaManyToManyMappingTests extends EclipseLinkContextMod contextJoinFetch.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); assertNull(contextJoinFetch.getValue()); // change context to INNER specifically (this time from no annotation), test resource contextJoinFetch.setValue(EclipseLinkJoinFetchType.INNER); - joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue()); assertEquals(EclipseLinkJoinFetchType.INNER, contextJoinFetch.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java index f6a417dd17..9acffbc17a 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java @@ -60,7 +60,7 @@ public class EclipseLinkJavaManyToOneMappingTests extends EclipseLinkContextMode EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -90,7 +90,7 @@ public class EclipseLinkJavaManyToOneMappingTests extends EclipseLinkContextMode // remove annotation, text context - attributeResource.removeSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertNull(joinFetchAnnotation.getValue()); assertNull(contextJoinFetch.getValue()); @@ -105,7 +105,7 @@ public class EclipseLinkJavaManyToOneMappingTests extends EclipseLinkContextMode EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -130,13 +130,13 @@ public class EclipseLinkJavaManyToOneMappingTests extends EclipseLinkContextMode contextJoinFetch.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); assertNull(contextJoinFetch.getValue()); // change context to INNER specifically (this time from no annotation), test resource contextJoinFetch.setValue(EclipseLinkJoinFetchType.INNER); - joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue()); assertEquals(EclipseLinkJoinFetchType.INNER, contextJoinFetch.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java index 4b67fa1fdc..d6c4d658b4 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java @@ -115,15 +115,15 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode readOnly.setSpecifiedReadOnly(Boolean.FALSE); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model readOnly.setSpecifiedReadOnly(Boolean.TRUE); - assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNotNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly()); readOnly.setSpecifiedReadOnly(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME)); assertEquals(null, readOnly.getSpecifiedReadOnly());//Boolean.FALSE and null really mean the same thing since there are only 2 states in the java resource model } @@ -137,12 +137,12 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - typeResource.removeSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); assertEquals(null, readOnly.getSpecifiedReadOnly()); assertEquals(false, readOnly.isDefaultReadOnly()); - typeResource.addSupportingAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); + typeResource.addAnnotation(EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, readOnly.getSpecifiedReadOnly()); } @@ -166,19 +166,19 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); customizer.setSpecifiedCustomizerClass(null); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizerAnnotation); customizer.setSpecifiedCustomizerClass("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals("Bar", customizerAnnotation.getValue()); } @@ -191,14 +191,14 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode assertEquals("Foo", customizer.getSpecifiedCustomizerClass()); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + EclipseLinkCustomizerAnnotation customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); customizerAnnotation.setValue("Bar"); assertEquals("Bar", customizer.getSpecifiedCustomizerClass()); - typeResource.removeSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); - customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addSupportingAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); + customizerAnnotation = (EclipseLinkCustomizerAnnotation) typeResource.addAnnotation(EclipseLinkCustomizerAnnotation.ANNOTATION_NAME); assertEquals(null, customizer.getSpecifiedCustomizerClass()); customizerAnnotation.setValue("FooBar"); @@ -212,7 +212,7 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = mappedSuperclass.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -268,7 +268,7 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode // remove annotation, text context - typeResource.removeSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + typeResource.removeAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertNull(resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getType()); @@ -283,7 +283,7 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode EclipseLinkMappedSuperclass mappedSuperclass = (EclipseLinkMappedSuperclass) getJavaPersistentType().getMapping(); EclipseLinkChangeTracking contextChangeTracking = mappedSuperclass.getChangeTracking(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); - EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + EclipseLinkChangeTrackingAnnotation resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -322,13 +322,13 @@ public class EclipseLinkJavaMappedSuperclassTests extends EclipseLinkContextMode contextChangeTracking.setSpecifiedType(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME)); assertNull(contextChangeTracking.getSpecifiedType()); // change context to AUTO specifically (this time from no annotation), test resource contextChangeTracking.setSpecifiedType(EclipseLinkChangeTrackingType.AUTO); - resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); + resourceChangeTracking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType.AUTO, resourceChangeTracking.getValue()); assertEquals(EclipseLinkChangeTrackingType.AUTO, contextChangeTracking.getSpecifiedType()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java index b60e540376..b23898d09a 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java @@ -139,19 +139,19 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); converter.setName(null); assertEquals(null, converter.getName()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getName()); converter.setName("bar"); assertEquals("bar", converter.getName()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); } @@ -168,14 +168,14 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setName("bar"); assertEquals("bar", converter.getName()); - attributeResource.removeSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setName("FOO"); @@ -209,19 +209,19 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getDataType()); converter.setDataType(null); assertEquals(null, converter.getDataType()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getDataType()); converter.setDataType("Bar"); assertEquals("Bar", converter.getDataType()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getDataType()); } @@ -238,14 +238,14 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setDataType("Bar"); assertEquals("Bar", converter.getDataType()); - attributeResource.removeSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setDataType("FooBar"); @@ -279,19 +279,19 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getObjectType()); converter.setObjectType(null); assertEquals(null, converter.getObjectType()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getObjectType()); converter.setObjectType("Bar"); assertEquals("Bar", converter.getObjectType()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getObjectType()); } @@ -308,14 +308,14 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setObjectType("Bar"); assertEquals("Bar", converter.getObjectType()); - attributeResource.removeSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setObjectType("FooBar"); @@ -334,7 +334,7 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); EclipseLinkConversionValue conversionValue = converter.addConversionValue(0); conversionValue.setDataValue("F"); @@ -394,7 +394,7 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converter.addConversionValue(0).setDataValue("F"); converter.addConversionValue(1).setDataValue("M"); @@ -432,7 +432,7 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converter.addConversionValue(0).setDataValue("F"); converter.addConversionValue(1).setDataValue("M"); @@ -469,7 +469,7 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.addConversionValue(0).setDataValue("F"); converterAnnotation.addConversionValue(1).setDataValue("M"); @@ -523,7 +523,7 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(0, converter.conversionValuesSize()); @@ -562,19 +562,19 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("baz", converterAnnotation.getDefaultObjectValue()); converter.setDefaultObjectValue(null); assertEquals(null, converter.getDefaultObjectValue()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getDefaultObjectValue()); converter.setDefaultObjectValue("bar"); assertEquals("bar", converter.getDefaultObjectValue()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getDefaultObjectValue()); } @@ -591,14 +591,14 @@ public class EclipseLinkJavaObjectTypeConverterTests extends EclipseLinkContextM JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkObjectTypeConverterAnnotation converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setDefaultObjectValue("baz"); assertEquals("baz", converter.getDefaultObjectValue()); - attributeResource.removeSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setDefaultObjectValue("FOO"); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java index 236eaac56a..499a88c13f 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java @@ -20,11 +20,11 @@ import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.resource.java.OneToManyAnnotation; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; +import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; +import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; @@ -126,11 +126,11 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); assertEquals(false, privateOwnable.isPrivateOwned()); privateOwnable.setPrivateOwned(true); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); assertEquals(true, privateOwnable.isPrivateOwned()); } @@ -146,11 +146,11 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); assertEquals(false, privateOwnable.isPrivateOwned()); - attributeResource.addSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); assertEquals(true, privateOwnable.isPrivateOwned()); } @@ -163,7 +163,7 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -193,7 +193,7 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode // remove annotation, text context - attributeResource.removeSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertNull(joinFetchAnnotation.getValue()); assertNull(contextJoinFetch.getValue()); @@ -208,7 +208,7 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -233,13 +233,13 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode contextJoinFetch.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); assertNull(contextJoinFetch.getValue()); // change context to INNER specifically (this time from no annotation), test resource contextJoinFetch.setValue(EclipseLinkJoinFetchType.INNER); - joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue()); assertEquals(EclipseLinkJoinFetchType.INNER, contextJoinFetch.getValue()); @@ -275,9 +275,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getFetch()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, annotation.getFetch()); } public void testDefaultOneToManySetTargetEntity() throws Exception { @@ -297,9 +298,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals("Foo", ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getTargetEntity()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals("Foo", annotation.getTargetEntity()); } public void testDefaultOneToManySetMappedBy() throws Exception { @@ -319,9 +321,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals("Foo", ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).getMappedBy()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals("Foo", annotation.getMappedBy()); } public void testDefaultOneToManySetCascadeAll() throws Exception { @@ -341,9 +344,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeAll()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeAll()); } public void testDefaultOneToManySetCascadeMerge() throws Exception { @@ -363,9 +367,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeMerge()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeMerge()); } public void testDefaultOneToManySetCascadePersist() throws Exception { @@ -385,9 +390,10 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadePersist()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadePersist()); } public void testDefaultOneToManySetCascadeRefresh() throws Exception { @@ -407,9 +413,9 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeRefresh()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertEquals(true, annotation.isCascadeRefresh()); } public void testDefaultOneToManySetCascadeRemove() throws Exception { @@ -429,8 +435,9 @@ public class EclipseLinkJavaOneToManyMappingTests extends EclipseLinkContextMode JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToManyAnnotation); - assertEquals(true, ((OneToManyAnnotation) attributeResource.getMappingAnnotation()).isCascadeRemove()); + OneToManyAnnotation annotation = + (OneToManyAnnotation) attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeRemove()); } } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java index 398803904a..a2b97b2f50 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java @@ -20,11 +20,11 @@ import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.resource.java.OneToOneAnnotation; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; +import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; +import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; @@ -126,11 +126,11 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); assertEquals(false, privateOwnable.isPrivateOwned()); privateOwnable.setPrivateOwned(true); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME)); assertEquals(true, privateOwnable.isPrivateOwned()); } @@ -146,11 +146,11 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); assertEquals(false, privateOwnable.isPrivateOwned()); - attributeResource.addSupportingAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME); assertEquals(true, privateOwnable.isPrivateOwned()); } @@ -163,7 +163,7 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test context value @@ -193,7 +193,7 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel // remove annotation, text context - attributeResource.removeSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertNull(joinFetchAnnotation.getValue()); assertNull(contextJoinFetch.getValue()); @@ -208,7 +208,7 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel EclipseLinkJoinFetch contextJoinFetch = manyToManyMapping.getJoinFetch(); JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + EclipseLinkJoinFetchAnnotation joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); // base annotated, test resource value @@ -233,13 +233,13 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel contextJoinFetch.setValue(null); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME)); assertNull(contextJoinFetch.getValue()); // change context to INNER specifically (this time from no annotation), test resource contextJoinFetch.setValue(EclipseLinkJoinFetchType.INNER); - joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); + joinFetchAnnotation = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType.INNER, joinFetchAnnotation.getValue()); assertEquals(EclipseLinkJoinFetchType.INNER, contextJoinFetch.getValue()); @@ -274,9 +274,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getFetch()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, annotation.getFetch()); } public void testDefaultOneToOneSetTargetEntity() throws Exception { @@ -296,9 +297,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals("Foo", ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getTargetEntity()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals("Foo", annotation.getTargetEntity()); } public void testDefaultOneToOneSetMappedBy() throws Exception { @@ -318,9 +320,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals("Foo", ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).getMappedBy()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals("Foo", annotation.getMappedBy()); } public void testDefaultOneToOneSetCascadeAll() throws Exception { @@ -340,9 +343,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeAll()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeAll()); } public void testDefaultOneToOneSetCascadeMerge() throws Exception { @@ -362,9 +366,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeMerge()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeMerge()); } public void testDefaultOneToOneSetCascadePersist() throws Exception { @@ -384,9 +389,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadePersist()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadePersist()); } public void testDefaultOneToOneSetCascadeRefresh() throws Exception { @@ -406,9 +412,10 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeRefresh()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeRefresh()); } public void testDefaultOneToOneSetCascadeRemove() throws Exception { @@ -428,8 +435,9 @@ public class EclipseLinkJavaOneToOneMappingTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - assertNotNull(attributeResource.getMappingAnnotation()); - assertTrue(attributeResource.getMappingAnnotation() instanceof OneToOneAnnotation); - assertEquals(true, ((OneToOneAnnotation) attributeResource.getMappingAnnotation()).isCascadeRemove()); + OneToOneAnnotation annotation = + (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME); + assertNotNull(annotation); + assertEquals(true, annotation.isCascadeRemove()); } } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java index 18f9ce8b8b..be7dfc8813 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java @@ -97,19 +97,19 @@ public class EclipseLinkJavaStructConverterTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); converter.setName(null); assertEquals(null, converter.getName()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getName()); converter.setName("bar"); assertEquals("bar", converter.getName()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); } @@ -126,14 +126,14 @@ public class EclipseLinkJavaStructConverterTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setName("bar"); assertEquals("bar", converter.getName()); - attributeResource.removeSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.addAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setName("FOO"); @@ -168,19 +168,19 @@ public class EclipseLinkJavaStructConverterTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getConverter()); converter.setConverterClass(null); assertEquals(null, converter.getConverterClass()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getConverter()); converter.setConverterClass("Bar"); assertEquals("Bar", converter.getConverterClass()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getConverter()); } @@ -197,14 +197,14 @@ public class EclipseLinkJavaStructConverterTests extends EclipseLinkContextModel JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + EclipseLinkStructConverterAnnotation converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setConverter("Bar"); assertEquals("Bar", converter.getConverterClass()); - attributeResource.removeSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkStructConverterAnnotation) attributeResource.addAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setConverter("FooBar"); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java index 361e96ed57..8e2163a2a5 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java @@ -116,19 +116,19 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); converter.setName(null); assertEquals(null, converter.getName()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getName()); converter.setName("bar"); assertEquals("bar", converter.getName()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("bar", converterAnnotation.getName()); } @@ -145,14 +145,14 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setName("bar"); assertEquals("bar", converter.getName()); - attributeResource.removeSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setName("FOO"); @@ -186,19 +186,19 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getDataType()); converter.setDataType(null); assertEquals(null, converter.getDataType()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getDataType()); converter.setDataType("Bar"); assertEquals("Bar", converter.getDataType()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getDataType()); } @@ -215,14 +215,14 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setDataType("Bar"); assertEquals("Bar", converter.getDataType()); - attributeResource.removeSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setDataType("FooBar"); @@ -256,19 +256,19 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getObjectType()); converter.setObjectType(null); assertEquals(null, converter.getObjectType()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, converterAnnotation.getObjectType()); converter.setObjectType("Bar"); assertEquals("Bar", converter.getObjectType()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals("Bar", converterAnnotation.getObjectType()); } @@ -285,14 +285,14 @@ public class EclipseLinkJavaTypeConverterTests extends EclipseLinkContextModelTe JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + EclipseLinkTypeConverterAnnotation converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); converterAnnotation.setObjectType("Bar"); assertEquals("Bar", converter.getObjectType()); - attributeResource.removeSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertEquals(null, eclipseLinkConvert.getConverter()); - converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); + converterAnnotation = (EclipseLinkTypeConverterAnnotation) attributeResource.addAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); assertNotNull(eclipseLinkConvert.getConverter()); converterAnnotation.setObjectType("FooBar"); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java index d5eb522b38..4ed998f60b 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java @@ -122,7 +122,7 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next(); VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); @@ -154,12 +154,12 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME); assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); versionMapping.setSpecifiedConverter(null); - assertNull(attributeResource.getSupportingAnnotation(TemporalAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME)); } public void testGetConvertUpdatesFromResourceModelChange() throws Exception { @@ -174,13 +174,13 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.addAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); convert.setValue("foo"); assertEquals(EclipseLinkConvert.ECLIPSE_LINK_CONVERTER, versionMapping.getConverter().getType()); assertEquals("foo", ((EclipseLinkConvert) versionMapping.getConverter()).getConverterName()); - attributeResource.removeSupportingAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME); assertEquals(Converter.NO_CONVERTER, versionMapping.getConverter().getType()); assertFalse(versionMapping.isDefault()); @@ -198,7 +198,7 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); mutableAnnotation.setValue(Boolean.TRUE); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); @@ -209,10 +209,10 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT mutableAnnotation.setValue(Boolean.FALSE); assertEquals(Boolean.FALSE, mutable.getSpecifiedMutable()); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutable.getSpecifiedMutable()); - attributeResource.addSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.addAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, mutable.getSpecifiedMutable()); } @@ -227,18 +227,18 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); assertEquals(null, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(null); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(null, mutableAnnotation); mutable.setSpecifiedMutable(Boolean.FALSE); - mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, mutableAnnotation.getValue()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -256,7 +256,7 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.FALSE); @@ -278,7 +278,7 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertFalse(mutable.isDefaultMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); @@ -306,7 +306,7 @@ public class EclipseLinkJavaVersionMappingTests extends EclipseLinkContextModelT JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME); JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next(); - attributeResource.removeSupportingAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); + attributeResource.removeAnnotation(EclipseLinkMutableAnnotation.ANNOTATION_NAME); assertTrue(mutable.isMutable()); mutable.setSpecifiedMutable(Boolean.TRUE); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java index f58fa7a92f..363108b29f 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CacheTests.java @@ -160,7 +160,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCache(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertNotNull(cache); } @@ -168,7 +168,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithCacheType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(CacheType.SOFT, cache.getType()); } @@ -176,7 +176,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithCacheType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(CacheType.SOFT, cache.getType()); cache.setType(CacheType.WEAK); @@ -195,7 +195,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithSize(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(50), cache.getSize()); } @@ -203,7 +203,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithSize(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(50), cache.getSize()); cache.setSize(Integer.valueOf(80)); @@ -222,7 +222,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithShared(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getShared()); } @@ -230,7 +230,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithShared(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getShared()); cache.setShared(Boolean.FALSE); @@ -243,11 +243,11 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithShared(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getShared()); cache.setShared(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CACHE)); assertSourceDoesNotContain("@Cache", cu); } @@ -256,7 +256,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithExpiry(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(50), cache.getExpiry()); } @@ -264,7 +264,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithExpiry(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Integer.valueOf(50), cache.getExpiry()); cache.setExpiry(Integer.valueOf(80)); @@ -283,7 +283,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithExpiryTimeOfDay(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertNotNull(timeOfDay); } @@ -292,7 +292,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCache(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); cache.addExpiryTimeOfDay(); assertNotNull(cache.getExpiryTimeOfDay()); @@ -304,7 +304,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithExpiryTimeOfDay(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertNotNull(cache.getExpiryTimeOfDay()); @@ -317,7 +317,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getAlwaysRefresh()); } @@ -325,7 +325,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getAlwaysRefresh()); cache.setAlwaysRefresh(Boolean.FALSE); @@ -338,11 +338,11 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithAlwaysRefresh(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getAlwaysRefresh()); cache.setAlwaysRefresh(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CACHE)); assertSourceDoesNotContain("@Cache", cu); } @@ -351,7 +351,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer()); } @@ -359,7 +359,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer()); cache.setRefreshOnlyIfNewer(Boolean.FALSE); @@ -372,11 +372,11 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithRefreshOnlyIfNewer(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getRefreshOnlyIfNewer()); cache.setRefreshOnlyIfNewer(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CACHE)); assertSourceDoesNotContain("@Cache", cu); } @@ -385,7 +385,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithDisableHits(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getDisableHits()); } @@ -393,7 +393,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithDisableHits(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getDisableHits()); cache.setDisableHits(Boolean.FALSE); @@ -406,11 +406,11 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestCacheWithDisableHits(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(Boolean.TRUE, cache.getDisableHits()); cache.setDisableHits(null); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE)); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CACHE)); assertSourceDoesNotContain("@Cache", cu); } @@ -420,7 +420,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestExistenceCheckingWithCoordinationType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cache.getCoordinationType()); } @@ -428,7 +428,7 @@ public class CacheTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestExistenceCheckingWithCoordinationType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); assertEquals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, cache.getCoordinationType()); cache.setCoordinationType(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java index 1933d85d5d..d38d81becd 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java @@ -54,7 +54,7 @@ public class ChangeTrackingTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestChangeTracking(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING); + EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CHANGE_TRACKING); assertNotNull(existenceChecking); } @@ -62,7 +62,7 @@ public class ChangeTrackingTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestChangeTrackingWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING); + EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CHANGE_TRACKING); assertEquals(ChangeTrackingType.DEFERRED, existenceChecking.getValue()); } @@ -70,7 +70,7 @@ public class ChangeTrackingTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestChangeTrackingWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CHANGE_TRACKING); + EclipseLinkChangeTrackingAnnotation existenceChecking = (EclipseLinkChangeTrackingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CHANGE_TRACKING); assertEquals(ChangeTrackingType.DEFERRED, existenceChecking.getValue()); existenceChecking.setValue(ChangeTrackingType.ATTRIBUTE); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java index bc88a46ba2..91392558eb 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java @@ -56,7 +56,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("F", converter.conversionValueAt(0).getDataValue()); } @@ -65,7 +65,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("F", converter.conversionValueAt(0).getDataValue()); converter.conversionValueAt(0).setDataValue("FOO"); @@ -79,7 +79,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals(0, converter.conversionValuesSize()); converter.addConversionValue(0).setDataValue("FOO"); @@ -95,7 +95,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Female", converter.conversionValueAt(0).getObjectValue()); } @@ -104,7 +104,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Female", converter.conversionValueAt(0).getObjectValue()); converter.conversionValueAt(0).setObjectValue("FOO"); @@ -118,7 +118,7 @@ public class ConversionValueAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals(0, converter.conversionValuesSize()); converter.addConversionValue(0).setObjectValue("FOO"); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java index 879a7a7c46..a4cdc9dc95 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java @@ -55,13 +55,13 @@ public class ConvertAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERT)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.CONVERT); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT)); + attributeResource.removeAnnotation(EclipseLinkJPA.CONVERT); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERT)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.CONVERT); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT)); + attributeResource.addAnnotation(EclipseLinkJPA.CONVERT); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERT)); } public void testGetValue() throws Exception { @@ -69,7 +69,7 @@ public class ConvertAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERT); assertEquals("myConverter", convert.getValue()); } @@ -78,7 +78,7 @@ public class ConvertAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERT); assertEquals("myConverter", convert.getValue()); convert.setValue("Bar"); @@ -92,7 +92,7 @@ public class ConvertAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERT); + EclipseLinkConvertAnnotation convert = (EclipseLinkConvertAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERT); assertEquals("myConverter", convert.getValue()); convert.setValue(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java index b0d331d605..3e49fec26e 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java @@ -68,13 +68,13 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.CONVERTER); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER)); + attributeResource.removeAnnotation(EclipseLinkJPA.CONVERTER); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.CONVERTER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER)); + attributeResource.addAnnotation(EclipseLinkJPA.CONVERTER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER)); } public void testGetConverterClass() throws Exception { @@ -82,7 +82,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("Foo", converter.getConverterClass()); } @@ -91,7 +91,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("Foo", converter.getConverterClass()); converter.setConverterClass("Bar"); @@ -105,7 +105,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("Foo", converter.getConverterClass()); converter.setConverterClass(null); @@ -120,7 +120,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("bar", converter.getName()); } @@ -129,7 +129,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("bar", converter.getName()); converter.setName("foo"); @@ -143,7 +143,7 @@ public class ConverterAnnotationTests extends EclipseLinkJavaResourceModelTestCa JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.CONVERTER); + EclipseLinkConverterAnnotation converter = (EclipseLinkConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.CONVERTER); assertEquals("bar", converter.getName()); converter.setName(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java index add63f2c84..3babb225d4 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java @@ -53,20 +53,20 @@ public class CustomizerAnnotationTests extends EclipseLinkJavaResourceModelTestC ICompilationUnit cu = this.createTestCustomizer(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER)); + assertNotNull(typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER)); - typeResource.removeSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER); - assertNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER)); + typeResource.removeAnnotation(EclipseLinkJPA.CUSTOMIZER); + assertNull(typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER)); - typeResource.addSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER); - assertNotNull(typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER)); + typeResource.addAnnotation(EclipseLinkJPA.CUSTOMIZER); + assertNotNull(typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER)); } public void testGetConverterClass() throws Exception { ICompilationUnit cu = this.createTestCustomizerWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER); + EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER); assertEquals("Foo", converter.getValue()); } @@ -74,7 +74,7 @@ public class CustomizerAnnotationTests extends EclipseLinkJavaResourceModelTestC ICompilationUnit cu = this.createTestCustomizerWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER); + EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER); assertEquals("Foo", converter.getValue()); converter.setValue("Bar"); @@ -87,7 +87,7 @@ public class CustomizerAnnotationTests extends EclipseLinkJavaResourceModelTestC ICompilationUnit cu = this.createTestCustomizerWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CUSTOMIZER); + EclipseLinkCustomizerAnnotation converter = (EclipseLinkCustomizerAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CUSTOMIZER); assertEquals("Foo", converter.getValue()); converter.setValue(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java index 9d8d10bc88..db0a70d887 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java @@ -54,7 +54,7 @@ public class ExistenceCheckingTests extends EclipseLinkJavaResourceModelTestCase ICompilationUnit cu = this.createTestExistenceChecking(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertNotNull(existenceChecking); } @@ -62,7 +62,7 @@ public class ExistenceCheckingTests extends EclipseLinkJavaResourceModelTestCase ICompilationUnit cu = this.createTestExistenceCheckingWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertEquals(ExistenceType.ASSUME_EXISTENCE, existenceChecking.getValue()); } @@ -70,7 +70,7 @@ public class ExistenceCheckingTests extends EclipseLinkJavaResourceModelTestCase ICompilationUnit cu = this.createTestExistenceCheckingWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); + EclipseLinkExistenceCheckingAnnotation existenceChecking = (EclipseLinkExistenceCheckingAnnotation) typeResource.getAnnotation(EclipseLinkJPA.EXISTENCE_CHECKING); assertEquals(ExistenceType.ASSUME_EXISTENCE, existenceChecking.getValue()); existenceChecking.setValue(ExistenceType.ASSUME_NON_EXISTENCE); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java index 2419198951..c74deddb4e 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java @@ -56,7 +56,7 @@ public class JoinFetchTests extends EclipseLinkJavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH); + EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.JOIN_FETCH); assertNotNull(joinFetch); } @@ -65,7 +65,7 @@ public class JoinFetchTests extends EclipseLinkJavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH); + EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.JOIN_FETCH); assertEquals(JoinFetchType.OUTER, joinFetch.getValue()); } @@ -74,7 +74,7 @@ public class JoinFetchTests extends EclipseLinkJavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.JOIN_FETCH); + EclipseLinkJoinFetchAnnotation joinFetch = (EclipseLinkJoinFetchAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.JOIN_FETCH); assertEquals(JoinFetchType.OUTER, joinFetch.getValue()); joinFetch.setValue(JoinFetchType.INNER); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java index 518a60c17f..b1576f5089 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java @@ -57,13 +57,13 @@ public class MutableAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.MUTABLE); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE)); + attributeResource.removeAnnotation(EclipseLinkJPA.MUTABLE); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.MUTABLE); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE)); + attributeResource.addAnnotation(EclipseLinkJPA.MUTABLE); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE)); } public void testGetValue() throws Exception { @@ -71,7 +71,7 @@ public class MutableAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE); assertEquals(Boolean.TRUE, mutableAnnotation.getValue()); } @@ -80,7 +80,7 @@ public class MutableAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE); assertEquals(Boolean.TRUE, mutableAnnotation.getValue()); mutableAnnotation.setValue(Boolean.FALSE); @@ -98,7 +98,7 @@ public class MutableAnnotationTests extends EclipseLinkJavaResourceModelTestCase JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.MUTABLE); + EclipseLinkMutableAnnotation mutableAnnotation = (EclipseLinkMutableAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.MUTABLE); assertEquals(Boolean.TRUE, mutableAnnotation.getValue()); mutableAnnotation.setValue(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java index fa903841a0..8629334893 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java @@ -109,13 +109,13 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); + attributeResource.removeAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); + attributeResource.addAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER)); } public void testGetDataType() throws Exception { @@ -123,7 +123,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); } @@ -132,7 +132,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); converter.setDataType("Bar"); @@ -150,7 +150,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); converter.setDataType(null); @@ -165,7 +165,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); } @@ -174,7 +174,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); converter.setObjectType("Bar"); @@ -192,7 +192,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); converter.setObjectType(null); @@ -207,7 +207,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("bar", converter.getName()); } @@ -216,7 +216,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("bar", converter.getName()); converter.setName("foo"); @@ -230,7 +230,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("bar", converter.getName()); converter.setName(null); @@ -246,7 +246,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("f", converter.getDefaultObjectValue()); } @@ -255,7 +255,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("f", converter.getDefaultObjectValue()); converter.setDefaultObjectValue("foo"); @@ -269,7 +269,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals("f", converter.getDefaultObjectValue()); converter.setDefaultObjectValue(null); @@ -284,7 +284,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals(0, converter.conversionValuesSize()); assertFalse(converter.conversionValues().hasNext()); @@ -295,7 +295,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); converter.addConversionValue(0); @@ -314,7 +314,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); assertEquals(2, converter.conversionValuesSize()); ListIterator<EclipseLinkConversionValueAnnotation> conversionValues = converter.conversionValues(); @@ -332,7 +332,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); converter.addConversionValue(0).setObjectValue("FOO"); converter.addConversionValue(1); @@ -353,7 +353,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); converter.addConversionValue(0).setObjectValue("FOO"); Iterator<EclipseLinkConversionValueAnnotation> conversionValues = converter.conversionValues(); @@ -387,7 +387,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); converter.addConversionValue(0).setObjectValue("FOO"); assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu); @@ -408,7 +408,7 @@ public class ObjectTypeConverterAnnotationTests extends EclipseLinkJavaResourceM JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); + EclipseLinkObjectTypeConverterAnnotation converter = (EclipseLinkObjectTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.OBJECT_TYPE_CONVERTER); converter.addConversionValue(0).setObjectValue("FOO"); assertSourceContains("@ObjectTypeConverter(conversionValues = {@ConversionValue(objectValue = \"FOO\"), @ConversionValue(dataValue = \"F\", objectValue = \"Female\"), @ConversionValue(dataValue = \"M\", objectValue = \"Male\")})", cu); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java index 94b3eb7901..e7007eb124 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java @@ -42,7 +42,7 @@ public class PrivateOwnedTests extends EclipseLinkJavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkPrivateOwnedAnnotation privateOwned = (EclipseLinkPrivateOwnedAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.PRIVATE_OWNED); + EclipseLinkPrivateOwnedAnnotation privateOwned = (EclipseLinkPrivateOwnedAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.PRIVATE_OWNED); assertNotNull(privateOwned); } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java index a5565b5b74..536593c199 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java @@ -40,7 +40,7 @@ public class ReadOnlyTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestReadOnly(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkReadOnlyAnnotation readOnly = (EclipseLinkReadOnlyAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.READ_ONLY); + EclipseLinkReadOnlyAnnotation readOnly = (EclipseLinkReadOnlyAnnotation) typeResource.getAnnotation(EclipseLinkJPA.READ_ONLY); assertNotNull(readOnly); } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java index 19c001d2e0..fc68fdf7b2 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java @@ -68,13 +68,13 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER) ; - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); + attributeResource.removeAnnotation(EclipseLinkJPA.READ_TRANSFORMER) ; + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); + attributeResource.addAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER)); } public void testGetTransformerClass() throws Exception { @@ -82,7 +82,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("Foo", readTransformer.getTransformerClass()); } @@ -91,7 +91,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("Foo", readTransformer.getTransformerClass()); readTransformer.setTransformerClass("Bar"); @@ -105,7 +105,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("Foo", readTransformer.getTransformerClass()); readTransformer.setTransformerClass(null); @@ -120,7 +120,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("transformerMethod", readTransformer.getMethod()); } @@ -129,7 +129,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("transformerMethod", readTransformer.getMethod()); readTransformer.setMethod("foo"); @@ -143,7 +143,7 @@ public class ReadTransformerAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.READ_TRANSFORMER); + EclipseLinkReadTransformerAnnotation readTransformer = (EclipseLinkReadTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.READ_TRANSFORMER); assertEquals("transformerMethod", readTransformer.getMethod()); readTransformer.setMethod(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java index eeb6a1d145..5dc757d3ab 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java @@ -68,13 +68,13 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); + attributeResource.removeAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); + attributeResource.addAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER)); } public void testGetConverter() throws Exception { @@ -82,7 +82,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("Foo", converter.getConverter()); } @@ -91,7 +91,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("Foo", converter.getConverter()); converter.setConverter("Bar"); @@ -105,7 +105,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("Foo", converter.getConverter()); converter.setConverter(null); @@ -120,7 +120,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("bar", converter.getName()); } @@ -129,7 +129,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("bar", converter.getName()); converter.setName("foo"); @@ -143,7 +143,7 @@ public class StructConverterAnnotationTests extends EclipseLinkJavaResourceModel JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); + EclipseLinkStructConverterAnnotation converter = (EclipseLinkStructConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.STRUCT_CONVERTER); assertEquals("bar", converter.getName()); converter.setName(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java index b8a65457b6..31e6cd85a9 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java @@ -93,7 +93,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDay(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); @@ -104,7 +104,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithHour(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getHour()); } @@ -113,7 +113,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithHour(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getHour()); @@ -133,7 +133,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithMinute(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getMinute()); } @@ -142,7 +142,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithMinute(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getMinute()); @@ -162,7 +162,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithSecond(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getSecond()); } @@ -171,7 +171,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithSecond(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getSecond()); @@ -191,7 +191,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithMillisecond(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getMillisecond()); } @@ -200,7 +200,7 @@ public class TimeOfDayTests extends EclipseLinkJavaResourceModelTestCase { ICompilationUnit cu = this.createTestTimeOfDayWithMillisecond(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getSupportingAnnotation(EclipseLinkJPA.CACHE); + EclipseLinkCacheAnnotation cache = (EclipseLinkCacheAnnotation) typeResource.getAnnotation(EclipseLinkJPA.CACHE); EclipseLinkTimeOfDayAnnotation timeOfDay = cache.getExpiryTimeOfDay(); assertEquals(Integer.valueOf(5), timeOfDay.getMillisecond()); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java index 59c5126315..6859987f49 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java @@ -70,13 +70,13 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION)); - attributeResource.setMappingAnnotation(null); - assertNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION)); + attributeResource.setPrimaryAnnotation(null, new String[0]); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION)); - attributeResource.setMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); - assertNotNull(attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION)); + attributeResource.setPrimaryAnnotation(EclipseLinkJPA.TRANSFORMATION, new String[0]); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION)); } public void testGetOptional() throws Exception { @@ -84,7 +84,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(Boolean.TRUE, transformation.getOptional()); } @@ -93,7 +93,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(Boolean.TRUE, transformation.getOptional()); transformation.setOptional(Boolean.FALSE); @@ -107,7 +107,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(Boolean.TRUE, transformation.getOptional()); transformation.setOptional(null); @@ -122,7 +122,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(FetchType.EAGER, transformation.getFetch()); } @@ -131,7 +131,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(FetchType.EAGER, transformation.getFetch()); transformation.setFetch(FetchType.LAZY); @@ -145,7 +145,7 @@ public class TransformationAnnotationTests extends EclipseLinkJavaResourceModelT JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getMappingAnnotation(EclipseLinkJPA.TRANSFORMATION); + EclipseLinkTransformationAnnotation transformation = (EclipseLinkTransformationAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TRANSFORMATION); assertEquals(FetchType.EAGER, transformation.getFetch()); transformation.setFetch(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java index a9728bd401..c80b9600a1 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java @@ -81,13 +81,13 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); + attributeResource.removeAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); + attributeResource.addAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER)); } public void testGetTypeDataType() throws Exception { @@ -95,7 +95,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); } @@ -104,7 +104,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); converter.setDataType("Bar"); @@ -122,7 +122,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getDataType()); converter.setDataType(null); @@ -137,7 +137,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); } @@ -146,7 +146,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); converter.setObjectType("Bar"); @@ -164,7 +164,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("Foo", converter.getObjectType()); converter.setObjectType(null); @@ -179,7 +179,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("bar", converter.getName()); } @@ -188,7 +188,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("bar", converter.getName()); converter.setName("foo"); @@ -202,7 +202,7 @@ public class TypeConverterAnnotationTests extends EclipseLinkJavaResourceModelTe JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.TYPE_CONVERTER); + EclipseLinkTypeConverterAnnotation converter = (EclipseLinkTypeConverterAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.TYPE_CONVERTER); assertEquals("bar", converter.getName()); converter.setName(null); diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java index d444f25634..bae78e4bb1 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java @@ -83,13 +83,13 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); - attributeResource.removeSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER) ; - assertNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); + attributeResource.removeAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER) ; + assertNull(attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); - attributeResource.addSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); - assertNotNull(attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); + attributeResource.addAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + assertNotNull(attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER)); } public void testGetTransformerClass() throws Exception { @@ -97,7 +97,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("Foo", writeTransformer.getTransformerClass()); } @@ -106,7 +106,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("Foo", writeTransformer.getTransformerClass()); writeTransformer.setTransformerClass("Bar"); @@ -120,7 +120,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("Foo", writeTransformer.getTransformerClass()); writeTransformer.setTransformerClass(null); @@ -135,7 +135,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("transformerMethod", writeTransformer.getMethod()); } @@ -144,7 +144,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("transformerMethod", writeTransformer.getMethod()); writeTransformer.setMethod("foo"); @@ -158,7 +158,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertEquals("transformerMethod", writeTransformer.getMethod()); writeTransformer.setMethod(null); @@ -174,7 +174,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertNotNull(writeTransformer.getColumn()); assertEquals("FOO", writeTransformer.getColumn().getName()); } @@ -184,7 +184,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertNull(writeTransformer.getColumn()); writeTransformer.addColumn(); @@ -202,7 +202,7 @@ public class WriteTransformerAnnotationTests extends EclipseLinkJavaResourceMode JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getSupportingAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); + EclipseLinkWriteTransformerAnnotation writeTransformer = (EclipseLinkWriteTransformerAnnotation) attributeResource.getAnnotation(EclipseLinkJPA.WRITE_TRANSFORMER); assertNotNull(writeTransformer.getColumn()); assertEquals("FOO", writeTransformer.getColumn().getName()); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JptUtilityTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JptUtilityTests.java index fb3fd8805a..e6b092bb4d 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JptUtilityTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JptUtilityTests.java @@ -11,8 +11,8 @@ package org.eclipse.jpt.utility.tests.internal; import junit.framework.Test; import junit.framework.TestSuite; - import org.eclipse.jpt.utility.tests.internal.enumerations.JptUtilityEnumerationsTests; +import org.eclipse.jpt.utility.tests.internal.iterables.EmptyIterableTests; import org.eclipse.jpt.utility.tests.internal.iterables.JptUtilityIterablesTests; import org.eclipse.jpt.utility.tests.internal.iterators.JptUtilityIteratorsTests; import org.eclipse.jpt.utility.tests.internal.model.JptUtilityModelTests; |