Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jaxb
diff options
context:
space:
mode:
authorpfullbright2012-04-18 12:44:44 -0400
committerpfullbright2012-04-18 12:44:44 -0400
commit1b44abe79ab5778ca5941afc525ec2000d0dba9e (patch)
tree4f785da9efb5890d1f74401d9f3043fe63a35627 /jaxb
parent62bccb6c0c7617a0af44b40b8c03cfc9c0c57798 (diff)
downloadwebtools.dali-1b44abe79ab5778ca5941afc525ec2000d0dba9e.tar.gz
webtools.dali-1b44abe79ab5778ca5941afc525ec2000d0dba9e.tar.xz
webtools.dali-1b44abe79ab5778ca5941afc525ec2000d0dba9e.zip
made ArrayIndexOutOfBoundsException throwing consistent
Diffstat (limited to 'jaxb')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAdaptableAttributeMapping.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlNodeMapping.java7
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyAttributeMappingTests.java30
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyElementMappingTests.java28
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java74
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java71
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefMappingTests.java32
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefsMappingTests.java32
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementsMappingTests.java22
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java48
12 files changed, 167 insertions, 189 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
index aff0abde76..373f603335 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextRoot.java
@@ -309,7 +309,7 @@ public abstract class AbstractJaxbContextRoot
}
return o.getAnnotation(JAXB.XML_TYPE) != null
|| o.getAnnotation(JAXB.XML_ROOT_ELEMENT) != null
- || o.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER) != null;
+ || o.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER) > 0;
}
});
CollectionTools.addAll(
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAdaptableAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAdaptableAttributeMapping.java
index b38cd7d452..690bd62843 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAdaptableAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAdaptableAttributeMapping.java
@@ -90,7 +90,10 @@ public abstract class AbstractJavaAdaptableAttributeMapping<A extends Annotation
}
protected XmlJavaTypeAdapterAnnotation getXmlJavaTypeAdapterAnnotation() {
- return (XmlJavaTypeAdapterAnnotation) getJavaResourceAttribute().getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ if (getJavaResourceAttribute().getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER) > 0) {
+ return (XmlJavaTypeAdapterAnnotation) getJavaResourceAttribute().getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ }
+ return null;
}
protected void initializeXmlJavaTypeAdapter() {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java
index b7a5cd46ed..2b702eea08 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java
@@ -189,7 +189,10 @@ public abstract class AbstractJavaType
}
protected XmlJavaTypeAdapterAnnotation getXmlJavaTypeAdapterAnnotation() {
- return (XmlJavaTypeAdapterAnnotation) getJavaResourceType().getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ if (getJavaResourceType().getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER) > 0) {
+ return (XmlJavaTypeAdapterAnnotation) getJavaResourceType().getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ }
+ return null;
}
protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlNodeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlNodeMapping.java
index 997d45adf5..8f5f0ca876 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlNodeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlNodeMapping.java
@@ -87,7 +87,7 @@ public abstract class AbstractJavaXmlNodeMapping<A extends Annotation>
if (this.xmlSchemaType == null) {
throw new IllegalStateException();
}
- this.getJavaResourceAttribute().removeAnnotation(JAXB.XML_SCHEMA_TYPE);
+ this.getJavaResourceAttribute().removeAnnotation(0, JAXB.XML_SCHEMA_TYPE);
this.setXmlSchemaType_(null);
}
@@ -96,7 +96,10 @@ public abstract class AbstractJavaXmlNodeMapping<A extends Annotation>
}
protected XmlSchemaTypeAnnotation getXmlSchemaTypeAnnotation() {
- return (XmlSchemaTypeAnnotation) this.getJavaResourceAttribute().getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+ if (getJavaResourceAttribute().getAnnotationsSize(JAXB.XML_SCHEMA_TYPE) > 0) {
+ return (XmlSchemaTypeAnnotation) getJavaResourceAttribute().getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+ }
+ return null;
}
protected void initializeXmlSchemaType() {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyAttributeMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyAttributeMappingTests.java
index e82e700eb3..2bf708def4 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyAttributeMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyAttributeMappingTests.java
@@ -25,7 +25,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlAnyAttributeMapping;
import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
import org.eclipse.jpt.jaxb.core.context.XmlElementMapping;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -101,17 +100,18 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest
XmlAnyAttributeMapping attributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = attributeMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
attributeMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
attributeMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
+ assertNull(attributeMapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -122,12 +122,10 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlAnyAttributeMapping attributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = attributeMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -135,9 +133,9 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest
GenericJavaXmlAnyAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
@@ -145,9 +143,9 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest
GenericJavaXmlAnyAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
} \ No newline at end of file
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyElementMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyElementMappingTests.java
index 392f95d821..f9f08dd5da 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyElementMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAnyElementMappingTests.java
@@ -32,7 +32,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -109,17 +108,18 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa
XmlAnyElementMapping attributeMapping = (XmlAnyElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = attributeMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
attributeMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
attributeMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
+ assertNull(attributeMapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -131,10 +131,8 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa
XmlAnyElementMapping attributeMapping = (XmlAnyElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = attributeMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
@@ -143,19 +141,19 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa
GenericJavaXmlAnyElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlAnyElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(attributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyLax() throws Exception {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
index aed0072858..d78aa5dcf2 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
@@ -32,8 +32,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -288,20 +286,21 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
JaxbClassMapping classMapping = jaxbClass.getMapping();
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
- XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
- JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute();
+ XmlAttributeMapping attributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = attributeMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertNull(attributeMapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
- xmlAttributeMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ attributeMapping.addXmlJavaTypeAdapter();
+
+ assertNotNull(attributeMapping.getXmlJavaTypeAdapter());
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
- xmlAttributeMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ attributeMapping.removeXmlJavaTypeAdapter();
+
+ assertNull(attributeMapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -313,11 +312,9 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -325,9 +322,9 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
@@ -335,9 +332,9 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyXmlSchemaType() throws Exception {
@@ -348,18 +345,19 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNull(xmlAttributeMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
+
xmlAttributeMapping.addXmlSchemaType();
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNotNull(xmlAttributeMapping.getXmlSchemaType());
- assertNotNull(xmlSchemaTypeAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE));
+
xmlAttributeMapping.removeXmlSchemaType();
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
+ assertNull(xmlAttributeMapping.getXmlSchemaType());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
}
public void testUpdateXmlSchemaType() throws Exception {
@@ -370,12 +368,10 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNull(xmlAttributeMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
+
//add an XmlSchemaType annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -383,19 +379,19 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas
GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA_TYPE);
}
});
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNotNull(xmlAttributeMapping.getXmlSchemaType());
- assertNotNull(xmlSchemaTypeAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE));
+
//remove the XmlSchemaType annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_SCHEMA_TYPE);
}
});
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNull(xmlAttributeMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
}
protected void addXmlAttributeMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
index 64ad796fcf..df976ef5ec 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
@@ -35,8 +35,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -550,20 +548,19 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
xmlElementMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
xmlElementMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -575,11 +572,9 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -587,19 +582,19 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyXmlSchemaType() throws Exception {
@@ -610,18 +605,19 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNull(xmlElementMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
+
xmlElementMapping.addXmlSchemaType();
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNotNull(xmlElementMapping.getXmlSchemaType());
- assertNotNull(xmlSchemaTypeAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE));
+
xmlElementMapping.removeXmlSchemaType();
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
+ assertNull(xmlElementMapping.getXmlSchemaType());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
}
public void testUpdateXmlSchemaType() throws Exception {
@@ -632,12 +628,11 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
+
assertNull(xmlElementMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
+
//add an XmlSchemaType annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -645,19 +640,19 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase
GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA_TYPE);
}
});
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNotNull(xmlElementMapping.getXmlSchemaType());
- assertNotNull(xmlSchemaTypeAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE));
+
//remove the XmlSchemaType annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_SCHEMA_TYPE);
}
});
- xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
+
assertNull(xmlElementMapping.getXmlSchemaType());
- assertNull(xmlSchemaTypeAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
}
protected void addXmlElementMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefMappingTests.java
index 96a910d5de..971bb119cd 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefMappingTests.java
@@ -30,7 +30,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlElementRefMapping;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -403,19 +402,18 @@ public class GenericJavaXmlElementRefMappingTests
XmlElementRefMapping xmlElementRefMapping = (XmlElementRefMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementRefMapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
xmlElementRefMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
xmlElementRefMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -426,12 +424,10 @@ public class GenericJavaXmlElementRefMappingTests
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlElementRefMapping xmlElementRefMapping = (XmlElementRefMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlElementRefMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -439,19 +435,19 @@ public class GenericJavaXmlElementRefMappingTests
GenericJavaXmlElementRefMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlElementRefMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
protected void addXmlElementRefMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefsMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefsMappingTests.java
index 2d74ff09a3..c5468d224f 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefsMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementRefsMappingTests.java
@@ -32,7 +32,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -244,19 +243,18 @@ public class GenericJavaXmlElementRefsMappingTests
XmlElementRefsMapping mapping = (XmlElementRefsMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
mapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(mapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
mapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -268,11 +266,9 @@ public class GenericJavaXmlElementRefsMappingTests
XmlElementRefsMapping mapping = (XmlElementRefsMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -280,19 +276,19 @@ public class GenericJavaXmlElementRefsMappingTests
GenericJavaXmlElementRefsMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(mapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlElementRefsMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyXmlElementWrapper() throws Exception {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementsMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementsMappingTests.java
index 8b5d73cb67..74e2a22167 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementsMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementsMappingTests.java
@@ -28,7 +28,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -194,21 +193,18 @@ public class GenericJavaXmlElementsMappingTests
XmlElementsMapping mapping = (XmlElementsMapping) CollectionTools.get(classMapping.getAttributes(), 0).getMapping();
JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
-
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
mapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(mapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
mapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -218,10 +214,8 @@ public class GenericJavaXmlElementsMappingTests
XmlElementsMapping mapping = (XmlElementsMapping) CollectionTools.get(classMapping.getAttributes(), 0).getMapping();
JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
-
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
AnnotatedElement annotatedElement = annotatedElement(resourceAttribute);
annotatedElement.edit(
@@ -230,10 +224,9 @@ public class GenericJavaXmlElementsMappingTests
GenericJavaXmlElementsMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNotNull(mapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
annotatedElement.edit(
new Member.Editor() {
@@ -241,10 +234,9 @@ public class GenericJavaXmlElementsMappingTests
GenericJavaXmlElementsMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
assertNull(mapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyXmlElementWrapper() throws Exception {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java
index d5d0d01dad..09e047f796 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java
@@ -26,7 +26,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
import org.eclipse.jpt.jaxb.core.context.XmlElementMapping;
import org.eclipse.jpt.jaxb.core.context.XmlValueMapping;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
@@ -115,20 +114,21 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase
JaxbClassMapping classMapping = ((JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0)).getMapping();
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
- XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping();
- JavaResourceAttribute resourceAttribute = xmlValueMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertNull(xmlValueMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
- xmlValueMapping.addXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
- xmlValueMapping.removeXmlJavaTypeAdapter();
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+ XmlValueMapping mapping = (XmlValueMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+
+ assertNull(mapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
+ mapping.addXmlJavaTypeAdapter();
+
+ assertNotNull(mapping.getXmlJavaTypeAdapter());
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
+ mapping.removeXmlJavaTypeAdapter();
+
+ assertNull(mapping.getXmlJavaTypeAdapter());
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testUpdateXmlJavaTypeAdapter() throws Exception {
@@ -138,12 +138,10 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase
JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping();
JavaResourceAttribute resourceAttribute = xmlValueMapping.getPersistentAttribute().getJavaResourceAttribute();
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlValueMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
-
-
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
+
//add an XmlJavaTypeAdapter annotation
AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
annotatedElement.edit(new Member.Editor() {
@@ -151,19 +149,19 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase
GenericJavaXmlValueMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter());
- assertNotNull(xmlJavaTypeAdapterAnnotation);
-
+ assertNotNull(resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER));
+
//remove the XmlJavaTypeAdapter annotation
annotatedElement.edit(new Member.Editor() {
public void edit(ModifiedDeclaration declaration) {
GenericJavaXmlValueMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER);
}
});
- xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
+
assertNull(xmlValueMapping.getXmlJavaTypeAdapter());
- assertNull(xmlJavaTypeAdapterAnnotation);
+ assertEquals(0, resourceAttribute.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
}
public void testModifyXmlList1() throws Exception {

Back to the top