diff options
Diffstat (limited to 'jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal')
18 files changed, 387 insertions, 405 deletions
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java index 2432b98e93..221e8855a9 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java @@ -61,13 +61,13 @@ public class GenericJavaAttributeXmlJavaTypeAdapterTests extends JaxbContextMode assertNull(contextXmlJavaTypeAdapter.getValue()); contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getValue()); assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); //verify the xml schema type annotation is not removed when the value is set to null contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getValue()); assertNull(contextXmlJavaTypeAdapter.getValue()); } @@ -108,13 +108,13 @@ public class GenericJavaAttributeXmlJavaTypeAdapterTests extends JaxbContextMode assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getType()); assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType()); assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getType()); assertEquals("int", contextXmlJavaTypeAdapter.getType()); assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); @@ -162,10 +162,10 @@ public class GenericJavaAttributeXmlJavaTypeAdapterTests extends JaxbContextMode } protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTER); } } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java index 526fbbf35b..7ebd9faf88 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java @@ -82,13 +82,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getElementName()); elementFactoryMethod.setElementName("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("bar", elementDeclAnnotation.getName()); assertEquals("bar", elementFactoryMethod.getElementName()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setElementName(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getName()); assertNull(elementFactoryMethod.getElementName()); } @@ -134,13 +134,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getDefaultValue()); elementFactoryMethod.setDefaultValue("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("bar", elementDeclAnnotation.getDefaultValue()); assertEquals("bar", elementFactoryMethod.getDefaultValue()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setDefaultValue(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getDefaultValue()); assertNull(elementFactoryMethod.getDefaultValue()); } @@ -186,13 +186,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getScope()); elementFactoryMethod.setScope("Bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("Bar", elementDeclAnnotation.getScope()); assertEquals("Bar", elementFactoryMethod.getScope()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setScope(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getScope()); assertNull(elementFactoryMethod.getScope()); } @@ -238,13 +238,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getSubstitutionHeadName()); elementFactoryMethod.setSubstitutionHeadName("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("bar", elementDeclAnnotation.getSubstitutionHeadName()); assertEquals("bar", elementFactoryMethod.getSubstitutionHeadName()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setSubstitutionHeadName(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getSubstitutionHeadName()); assertNull(elementFactoryMethod.getSubstitutionHeadName()); } @@ -290,13 +290,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getSubstitutionHeadNamespace()); elementFactoryMethod.setSubstitutionHeadNamespace("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("bar", elementDeclAnnotation.getSubstitutionHeadNamespace()); assertEquals("bar", elementFactoryMethod.getSubstitutionHeadNamespace()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setSubstitutionHeadNamespace(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getSubstitutionHeadNamespace()); assertNull(elementFactoryMethod.getSubstitutionHeadNamespace()); } @@ -342,13 +342,13 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa assertNull(elementFactoryMethod.getNamespace()); elementFactoryMethod.setNamespace("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertEquals("bar", elementDeclAnnotation.getNamespace()); assertEquals("bar", elementFactoryMethod.getNamespace()); //verify the xml element decl annotation is not removed when the element name is set to null elementFactoryMethod.setNamespace(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); + elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); assertNull(elementDeclAnnotation.getNamespace()); assertNull(elementFactoryMethod.getNamespace()); } @@ -387,11 +387,11 @@ public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCa } protected Annotation getXmlElementDeclAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlElementDeclAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ELEMENT_DECL); } protected void removeXmlElementDeclAnnotation(ModifiedDeclaration declaration) { - this.removeAnnotation(declaration, XmlElementDeclAnnotation.ANNOTATION_NAME); + this.removeAnnotation(declaration, JAXB.XML_ELEMENT_DECL); } protected void addXmlElementDeclTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java index 1d93c8c7dd..e9c3d9a693 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java @@ -83,14 +83,14 @@ public class GenericJavaEnumConstantTests extends JaxbContextModelTestCase assertNull(contextEnumConstant.getSpecifiedValue()); contextEnumConstant.setSpecifiedValue("foo"); - XmlEnumValueAnnotation enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(XmlEnumValueAnnotation.ANNOTATION_NAME); + XmlEnumValueAnnotation enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); assertEquals("foo", enumValueAnnotation.getValue()); assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); assertEquals("foo", contextEnumConstant.getValue()); assertEquals("foo", contextEnumConstant.getSpecifiedValue()); contextEnumConstant.setSpecifiedValue(null); - enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(XmlEnumValueAnnotation.ANNOTATION_NAME); + enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); assertNull(enumValueAnnotation.getValue()); assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); assertEquals("MONDAY", contextEnumConstant.getValue()); diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java index 7e6634b112..410125c98f 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java @@ -32,7 +32,6 @@ import org.eclipse.jpt.jaxb.core.resource.java.JAXB; import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -67,7 +66,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getDefaultAccessType()); contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); + XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_TYPE); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.FIELD, accessorTypeAnnotation.getValue()); assertEquals(XmlAccessType.FIELD, contextPackageInfo.getAccessType()); @@ -80,7 +79,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase assertEquals(XmlAccessType.NONE, contextPackageInfo.getAccessType()); contextPackageInfo.setSpecifiedAccessType(null); - accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); + accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_TYPE); assertNull(accessorTypeAnnotation.getValue()); assertNull(contextPackageInfo.getSpecifiedAccessType()); assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); @@ -100,7 +99,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__FIELD); + GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__FIELD); } }); assertEquals(XmlAccessType.FIELD, contextPackageInfo.getAccessType()); @@ -108,7 +107,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase //set the accesser type value to PUBLIC_MEMBER annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); + GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); } }); assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); @@ -116,7 +115,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase //set the accesser type value to NONE annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__NONE); + GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__NONE); } }); assertEquals(XmlAccessType.NONE, contextPackageInfo.getAccessType()); @@ -141,12 +140,12 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getDefaultAccessOrder()); contextPackageInfo.setSpecifiedAccessOrder(XmlAccessOrder.UNDEFINED); - XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); + XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.UNDEFINED, accessorOrderAnnotation.getValue()); assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); contextPackageInfo.setSpecifiedAccessOrder(null); - accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); + accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER); assertNull(accessorOrderAnnotation.getValue()); assertNull(contextPackageInfo.getSpecifiedAccessOrder()); assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); @@ -166,7 +165,7 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_ORDER__UNDEFINED); + GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_ORDER, JAXB.XML_ACCESS_ORDER__UNDEFINED); } }); assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); @@ -184,15 +183,15 @@ public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase //add another package annotation so that the context model object doesn't get removed when //removing the XmlAccessorType annotation. Only "annotated" packages are added to the context model protected void removeXmlAccessorTypeAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA); + this.removeAnnotation(declaration, JAXB.XML_ACCESSOR_TYPE); } //add another package annotation so that the context model object doesn't get removed when //removing the XmlAccessorOrder annotation. Only "annotated" packages are added to the context model protected void removeXmlAccessorOrderAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA); + this.removeAnnotation(declaration, JAXB.XML_ACCESSOR_ORDER); } public void testGetXmlSchemaTypes() throws Exception { diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java index 0cd9a9acbd..0d45116955 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java @@ -21,7 +21,6 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -50,13 +49,13 @@ public class GenericJavaPackageXmlJavaTypeAdapterTests extends JaxbContextModelT assertNull(contextXmlJavaTypeAdapter.getValue()); contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getValue()); assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); //verify the xml schema type annotation is not removed when the value is set to null contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getValue()); assertNull(contextXmlJavaTypeAdapter.getValue()); } @@ -97,13 +96,13 @@ public class GenericJavaPackageXmlJavaTypeAdapterTests extends JaxbContextModelT assertNull(contextXmlJavaTypeAdapter.getDefaultType()); contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getType()); assertEquals("foo", contextXmlJavaTypeAdapter.getType()); //verify the xml schema type annotation is not removed when the type is set to null contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getType()); assertNull(contextXmlJavaTypeAdapter.getType()); assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); @@ -151,11 +150,11 @@ public class GenericJavaPackageXmlJavaTypeAdapterTests extends JaxbContextModelT //add another package annotation so that the context model object doesn't get removed when //removing the XmlJavaTypeAdapter annotation. Only "annotated" packages are added to the context model protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ACCESSOR_ORDER); + this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTER); } } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java index 73bb001a97..29bad05e04 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java @@ -43,11 +43,9 @@ import org.eclipse.jpt.jaxb.core.internal.context.java.PropertyAccessor; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -271,22 +269,22 @@ public class GenericJavaPersistentClassTests assertNull(persistentClass.getFactoryClass()); persistentClass.setFactoryClass("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); assertEquals("foo", persistentClass.getFactoryClass()); persistentClass.setFactoryClass(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getFactoryClass()); assertNull(persistentClass.getFactoryClass()); //add another annotation so that the context model does not get blown away persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceType.removeAnnotation(JAXB.XML_TYPE); //set factoryClass again, this time starting with no XmlType annotation persistentClass.setFactoryClass("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); assertEquals("foo", persistentClass.getFactoryClass()); } @@ -328,22 +326,22 @@ public class GenericJavaPersistentClassTests assertNull(persistentClass.getFactoryMethod()); persistentClass.setFactoryMethod("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); assertEquals("foo", persistentClass.getFactoryMethod()); persistentClass.setFactoryMethod(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getFactoryMethod()); assertNull(persistentClass.getFactoryMethod()); //add another annotation so that the context model does not get blown away persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceType.removeAnnotation(JAXB.XML_TYPE); //set factoryMethod again, this time starting with no XmlType annotation persistentClass.setFactoryMethod("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); assertEquals("foo", persistentClass.getFactoryMethod()); } @@ -388,24 +386,24 @@ public class GenericJavaPersistentClassTests assertEquals(defaultXmlTypeName, persistentClass.getQName().getName()); persistentClass.getQName().setSpecifiedName("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getName()); assertEquals("foo", persistentClass.getQName().getSpecifiedName()); assertEquals("foo", persistentClass.getQName().getName()); persistentClass.getQName().setSpecifiedName(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getName()); assertNull(persistentClass.getQName().getSpecifiedName()); assertEquals(defaultXmlTypeName, persistentClass.getQName().getName()); //add another annotation so that the context model does not get blown away persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceType.removeAnnotation(JAXB.XML_TYPE); //set name again, this time starting with no XmlType annotation persistentClass.getQName().setSpecifiedName("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getName()); assertEquals("foo", persistentClass.getQName().getSpecifiedName()); assertEquals("foo", persistentClass.getQName().getName()); @@ -454,24 +452,24 @@ public class GenericJavaPersistentClassTests assertEquals("", persistentClass.getQName().getNamespace()); persistentClass.getQName().setSpecifiedNamespace("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getNamespace()); assertEquals("foo", persistentClass.getQName().getSpecifiedNamespace()); assertEquals("foo", persistentClass.getQName().getNamespace()); persistentClass.getQName().setSpecifiedNamespace(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getNamespace()); assertNull(persistentClass.getQName().getSpecifiedNamespace()); assertEquals("", persistentClass.getQName().getNamespace()); //add another annotation so that the context model does not get blown away persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceType.removeAnnotation(JAXB.XML_TYPE); //set namespace again, this time starting with no XmlType annotation persistentClass.getQName().setSpecifiedNamespace("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getNamespace()); assertEquals("foo", persistentClass.getQName().getSpecifiedNamespace()); assertEquals("foo", persistentClass.getQName().getNamespace()); @@ -519,7 +517,7 @@ public class GenericJavaPersistentClassTests assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getDefaultAccessType()); persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); + XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.FIELD, accessorTypeAnnotation.getValue()); assertEquals(XmlAccessType.FIELD, persistentClass.getAccessType()); @@ -532,7 +530,7 @@ public class GenericJavaPersistentClassTests assertEquals(XmlAccessType.NONE, persistentClass.getAccessType()); persistentClass.setSpecifiedAccessType(null); - accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); + accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); assertNull(accessorTypeAnnotation.getValue()); assertNull(persistentClass.getSpecifiedAccessType()); assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); @@ -553,7 +551,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceType); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__FIELD); + GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__FIELD); } }); assertEquals(XmlAccessType.FIELD, persistentClass.getAccessType()); @@ -561,7 +559,7 @@ public class GenericJavaPersistentClassTests //set the accesser type value to PUBLIC_MEMBER annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); + GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); } }); assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); @@ -569,14 +567,14 @@ public class GenericJavaPersistentClassTests //set the accesser type value to NONE annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__NONE); + GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE__NONE); } }); assertEquals(XmlAccessType.NONE, persistentClass.getAccessType()); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ACCESSOR_TYPE); } }); assertNull(persistentClass.getSpecifiedAccessType()); @@ -628,7 +626,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(persistentClass.getJavaResourceType()); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlTypeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_TYPE); } }); assertEquals(persistentClass, childPersistentClass.getSuperClass()); @@ -644,12 +642,12 @@ public class GenericJavaPersistentClassTests assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getDefaultAccessOrder()); persistentClass.setSpecifiedAccessOrder(XmlAccessOrder.UNDEFINED); - XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); + XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.UNDEFINED, accessorOrderAnnotation.getValue()); assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); persistentClass.setSpecifiedAccessOrder(null); - accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); + accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); assertNull(accessorOrderAnnotation.getValue()); assertNull(persistentClass.getSpecifiedAccessOrder()); assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); @@ -669,14 +667,14 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceType); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_ORDER__UNDEFINED); + GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_ORDER, JAXB.XML_ACCESS_ORDER__UNDEFINED); } }); assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ACCESSOR_ORDER); } }); assertNull(persistentClass.getSpecifiedAccessOrder()); @@ -738,7 +736,7 @@ public class GenericJavaPersistentClassTests persistentClass.addProp(0, "foo"); persistentClass.addProp(0, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); ListIterator<String> props = xmlTypeAnnotation.getPropOrder().iterator(); assertEquals("baz", props.next()); @@ -756,7 +754,7 @@ public class GenericJavaPersistentClassTests persistentClass.addProp(1, "foo"); persistentClass.addProp(0, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); ListIterator<String> props = xmlTypeAnnotation.getPropOrder().iterator(); assertEquals("baz", props.next()); @@ -774,7 +772,7 @@ public class GenericJavaPersistentClassTests persistentClass.addProp(1, "foo"); persistentClass.addProp(2, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); persistentClass.removeProp(1); @@ -802,7 +800,7 @@ public class GenericJavaPersistentClassTests persistentClass.addProp(1, "foo"); persistentClass.addProp(2, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); assertEquals(3, xmlTypeAnnotation.getPropOrderSize()); @@ -933,7 +931,7 @@ public class GenericJavaPersistentClassTests } protected Annotation getXmlTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlTypeAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_TYPE); } protected void moveProp(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { @@ -954,13 +952,13 @@ public class GenericJavaPersistentClassTests assertFalse(persistentClass.isRootElement()); persistentClass.setRootElement("foo"); - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertEquals("foo", xmlRootElementAnnotation.getName()); assertEquals("foo", persistentClass.getRootElement().getQName().getName()); assertTrue(persistentClass.isRootElement()); persistentClass.setRootElement(null); - xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertNull(xmlRootElementAnnotation); assertNull(persistentClass.getRootElement()); assertFalse(persistentClass.isRootElement()); @@ -1068,7 +1066,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceField); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlTransientAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TRANSIENT); } }); //@XmlTransient @@ -1105,7 +1103,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlTransientAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_TRANSIENT); } }); } @@ -1260,7 +1258,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceField); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1297,7 +1295,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD); @@ -1334,7 +1332,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceField); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1371,7 +1369,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.TRANSIENT_KEYWORD); @@ -1408,7 +1406,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceField); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1445,7 +1443,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.STATIC_KEYWORD); @@ -1482,7 +1480,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceField); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1519,7 +1517,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); } @@ -1569,7 +1567,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1606,7 +1604,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); } @@ -1641,7 +1639,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1678,7 +1676,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); } @@ -1722,7 +1720,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1759,7 +1757,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); } @@ -1799,7 +1797,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1836,7 +1834,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); } @@ -1874,7 +1872,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceGetter); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1911,7 +1909,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); this.removeModifiers(resourceGetter, ModifierKeyword.STATIC_KEYWORD); @@ -1956,7 +1954,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceGetter); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTRIBUTE); } }); //@XmlAttribute @@ -1993,7 +1991,7 @@ public class GenericJavaPersistentClassTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ATTRIBUTE); } }); this.removeModifiers(resourceGetter, ModifierKeyword.PRIVATE_KEYWORD); @@ -2008,17 +2006,17 @@ public class GenericJavaPersistentClassTests JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); JavaResourceAbstractType resourceType = persistentClass.getJavaResourceType(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(persistentClass.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); persistentClass.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(persistentClass.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); persistentClass.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); } public void testUpdateXmlJavaTypeAdapter() throws Exception { @@ -2027,7 +2025,7 @@ public class GenericJavaPersistentClassTests JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); JavaResourceAbstractType resourceType = persistentClass.getJavaResourceType(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(persistentClass.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -2036,20 +2034,20 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceType); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(persistentClass.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(persistentClass.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -2156,7 +2154,7 @@ public class GenericJavaPersistentClassTests AnnotatedElement annotatedElement = this.annotatedElement(resourceClass); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, accessType); + GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, JAXB.XML_ACCESSOR_TYPE, accessType); } }); } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java index 618fafe311..80a161f521 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java @@ -62,16 +62,16 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertNull(contextEnum.getFactoryClass()); contextEnum.setFactoryClass("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); assertEquals("foo", contextEnum.getFactoryClass()); contextEnum.setFactoryClass(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getFactoryClass()); assertNull(contextEnum.getFactoryClass()); - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceEnum.removeAnnotation(JAXB.XML_TYPE); assertNull(contextEnum.getFactoryClass()); } @@ -113,20 +113,20 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertNull(contextEnum.getFactoryMethod()); contextEnum.setFactoryMethod("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); assertEquals("foo", contextEnum.getFactoryMethod()); contextEnum.setFactoryMethod(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getFactoryMethod()); assertNull(contextEnum.getFactoryMethod()); - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceEnum.removeAnnotation(JAXB.XML_TYPE); //set factoryMethod again, this time starting with no XmlType annotation contextEnum.setFactoryMethod("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); assertEquals("foo", contextEnum.getFactoryMethod()); } @@ -172,22 +172,22 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertEquals(defaultXmlTypeName, contextEnum.getQName().getName()); contextEnum.getQName().setSpecifiedName("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getName()); assertEquals("foo", contextEnum.getQName().getSpecifiedName()); assertEquals("foo", contextEnum.getQName().getName()); contextEnum.getQName().setSpecifiedName(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getName()); assertNull(contextEnum.getQName().getSpecifiedName()); assertEquals(defaultXmlTypeName, contextEnum.getQName().getName()); - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceEnum.removeAnnotation(JAXB.XML_TYPE); //set name again, this time starting with no XmlType annotation contextEnum.getQName().setSpecifiedName("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getName()); assertEquals("foo", contextEnum.getQName().getSpecifiedName()); assertEquals("foo", contextEnum.getQName().getName()); @@ -237,22 +237,22 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertEquals("", contextEnum.getQName().getNamespace()); contextEnum.getQName().setSpecifiedNamespace("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getNamespace()); assertEquals("foo", contextEnum.getQName().getSpecifiedNamespace()); assertEquals("foo", contextEnum.getQName().getNamespace()); contextEnum.getQName().setSpecifiedNamespace(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertNull(xmlTypeAnnotation.getNamespace()); assertNull(contextEnum.getQName().getSpecifiedNamespace()); assertEquals("", contextEnum.getQName().getNamespace()); - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + resourceEnum.removeAnnotation(JAXB.XML_TYPE); //set namespace again, this time starting with no XmlType annotation contextEnum.getQName().setSpecifiedNamespace("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals("foo", xmlTypeAnnotation.getNamespace()); assertEquals("foo", contextEnum.getQName().getSpecifiedNamespace()); assertEquals("foo", contextEnum.getQName().getNamespace()); @@ -344,7 +344,7 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase contextEnum.addProp(0, "foo"); contextEnum.addProp(0, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); ListIterator<String> props = xmlTypeAnnotation.getPropOrder().iterator(); assertEquals("baz", props.next()); @@ -362,7 +362,7 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase contextEnum.addProp(1, "foo"); contextEnum.addProp(0, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); ListIterator<String> props = xmlTypeAnnotation.getPropOrder().iterator(); assertEquals("baz", props.next()); @@ -380,7 +380,7 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase contextEnum.addProp(1, "foo"); contextEnum.addProp(2, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); contextEnum.removeProp(1); @@ -408,7 +408,7 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase contextEnum.addProp(1, "foo"); contextEnum.addProp(2, "baz"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); + XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(JAXB.XML_TYPE); assertEquals(3, xmlTypeAnnotation.getPropOrderSize()); @@ -546,11 +546,11 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase } protected Annotation getXmlTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlTypeAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_TYPE); } protected Annotation getXmlEnumAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlEnumAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ENUM); } protected void moveProp(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { @@ -571,13 +571,13 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertFalse(contextEnum.isRootElement()); contextEnum.setRootElement("foo"); - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertEquals("foo", xmlRootElementAnnotation.getName()); assertEquals("foo", contextEnum.getRootElement().getQName().getName()); assertTrue(contextEnum.isRootElement()); contextEnum.setRootElement(null); - xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertNull(xmlRootElementAnnotation); assertNull(contextEnum.getRootElement()); assertFalse(contextEnum.isRootElement()); @@ -623,17 +623,17 @@ public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase assertNull(contextEnum.getEnumType()); contextEnum.setEnumType("Integer"); - XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); + XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM); assertEquals("Integer", xmlEnumAnnotation.getValue()); assertEquals("Integer", contextEnum.getEnumType()); contextEnum.setEnumType(null); - xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); + xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM); assertNull(xmlEnumAnnotation.getValue()); assertNull(contextEnum.getEnumType()); - resourceEnum.addAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - resourceEnum.removeAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); + resourceEnum.addAnnotation(JAXB.XML_TYPE); + resourceEnum.removeAnnotation(JAXB.XML_ENUM); contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); assertNull(contextEnum.getEnumType()); } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java index 4819c1850c..5bf9d2f794 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java @@ -22,7 +22,6 @@ import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -58,13 +57,13 @@ public class GenericJavaTypeXmlJavaTypeAdapterTests extends JaxbContextModelTest assertNull(contextXmlJavaTypeAdapter.getValue()); contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getValue()); assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); //verify the xml schema type annotation is not removed when the value is set to null contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getValue()); assertNull(contextXmlJavaTypeAdapter.getValue()); } @@ -105,13 +104,13 @@ public class GenericJavaTypeXmlJavaTypeAdapterTests extends JaxbContextModelTest assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertEquals("foo", javaTypeAdapterAnnotation.getType()); assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType()); assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(javaTypeAdapterAnnotation.getType()); assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType()); assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); @@ -161,11 +160,11 @@ public class GenericJavaTypeXmlJavaTypeAdapterTests extends JaxbContextModelTest //add another package annotation so that the context model object doesn't get removed when //removing the XmlJavaTypeAdapter annotation. Only "annotated" packages are added to the context model protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ACCESSOR_ORDER); + this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTER); } } 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 d6e21823e5..21d715cd0b 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 @@ -24,9 +24,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.XmlAnyAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -65,32 +62,32 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest JavaResourceAttribute resourceAttribute = xmlAnyAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlAnyAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlAnyAttributeAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ANY_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); xmlAnyAttributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAnyAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyAttributeAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlAnyAttributeAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_ANY_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); xmlAnyAttributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAnyAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyAttributeAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -101,17 +98,17 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest XmlAnyAttributeMapping xmlAnyAttributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAnyAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlAnyAttributeMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAnyAttributeMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlAnyAttributeMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); } public void testUpdateXmlJavaTypeAdapter() throws Exception { @@ -122,7 +119,7 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest XmlAnyAttributeMapping xmlAnyAttributeMapping = (XmlAnyAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAnyAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -131,20 +128,20 @@ public class GenericJavaXmlAnyAttributeMappingTests extends JaxbContextModelTest AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAnyAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAnyAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAnyAttributeMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAnyAttributeMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAnyAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } 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 47d5c589b6..cc6a42c6cc 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 @@ -28,8 +28,6 @@ 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.XmlAnyElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; 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; @@ -69,32 +67,32 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa JavaResourceAttribute resourceAttribute = xmlAnyElementMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlAnyElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ANY_ELEMENT_ATTRIBUTE_MAPPING_KEY); xmlAnyElementMapping = (XmlAnyElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlAnyElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_ANY_ELEMENT_ATTRIBUTE_MAPPING_KEY); xmlAnyElementMapping = (XmlAnyElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlAnyElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -105,17 +103,17 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa XmlAnyElementMapping xmlAnyElementMapping = (XmlAnyElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAnyElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlAnyElementMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAnyElementMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlAnyElementMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); } public void testUpdateXmlJavaTypeAdapter() throws Exception { @@ -126,7 +124,7 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa XmlAnyElementMapping xmlAnyElementMapping = (XmlAnyElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAnyElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -135,20 +133,20 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAnyElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAnyElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAnyElementMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAnyElementMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAnyElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAnyElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -165,14 +163,14 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa assertEquals(false, xmlAnyElementMapping.isLax()); xmlAnyElementMapping.setSpecifiedLax(Boolean.TRUE); - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME); + XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); assertEquals(Boolean.TRUE, xmlAnyElementAnnotation.getLax()); assertEquals(Boolean.TRUE, xmlAnyElementMapping.getSpecifiedLax()); assertEquals(false, xmlAnyElementMapping.isDefaultLax()); assertEquals(true, xmlAnyElementMapping.isLax()); xmlAnyElementMapping.setSpecifiedLax(null); - xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME); + xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); assertNull(xmlAnyElementMapping.getSpecifiedLax()); assertEquals(false, xmlAnyElementMapping.isDefaultLax()); assertEquals(false, xmlAnyElementMapping.isLax()); @@ -223,12 +221,12 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa assertNull(xmlAnyElementMapping.getSpecifiedValue()); xmlAnyElementMapping.setSpecifiedValue("Foo"); - XmlAnyElementAnnotation xmlElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME); + XmlAnyElementAnnotation xmlElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); assertEquals("Foo", xmlAnyElementMapping.getSpecifiedValue()); assertEquals("Foo", xmlAnyElementMapping.getValue()); xmlAnyElementMapping.setSpecifiedValue(null); - xmlElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(XmlAnyElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); assertNull(xmlElementAnnotation.getValue()); assertNull(xmlAnyElementMapping.getSpecifiedValue()); } @@ -274,7 +272,7 @@ public class GenericJavaXmlAnyElementMappingTests extends JaxbContextModelTestCa } protected Annotation getXmlAnyElementAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlAnyElementAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ANY_ELEMENT); } public void testModifyXmlMixed() 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 ec13d08334..a183b406fe 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 @@ -28,7 +28,6 @@ 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.XmlAttachmentRefAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; 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; @@ -74,14 +73,14 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas assertEquals("id", xmlAttributeMapping.getQName().getName()); xmlAttributeMapping.getQName().setSpecifiedName("foo"); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertEquals("foo", xmlAttributeAnnotation.getName()); assertEquals("foo", xmlAttributeMapping.getQName().getSpecifiedName()); assertEquals("id", xmlAttributeMapping.getQName().getDefaultName()); assertEquals("foo", xmlAttributeMapping.getQName().getName()); xmlAttributeMapping.getQName().setSpecifiedName(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertNull(xmlAttributeAnnotation.getName()); assertNull(xmlAttributeMapping.getQName().getSpecifiedName()); } @@ -125,12 +124,12 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas assertNull(xmlAttributeMapping.getQName().getSpecifiedNamespace()); xmlAttributeMapping.getQName().setSpecifiedNamespace("foo"); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertEquals("foo", xmlAttributeAnnotation.getNamespace()); assertEquals("foo", xmlAttributeMapping.getQName().getNamespace()); xmlAttributeMapping.getQName().setSpecifiedNamespace(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertNull(xmlAttributeAnnotation.getNamespace()); assertNull(xmlAttributeMapping.getQName().getSpecifiedNamespace()); } @@ -176,14 +175,14 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas assertEquals(false, xmlAttributeMapping.isRequired()); xmlAttributeMapping.setSpecifiedRequired(Boolean.TRUE); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertEquals(Boolean.TRUE, xmlAttributeAnnotation.getRequired()); assertEquals(Boolean.TRUE, xmlAttributeMapping.getSpecifiedRequired()); assertEquals(false, xmlAttributeMapping.isDefaultRequired()); assertEquals(true, xmlAttributeMapping.isRequired()); xmlAttributeMapping.setSpecifiedRequired(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); + xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); assertNull(xmlAttributeAnnotation.getName()); assertNull(xmlAttributeMapping.getSpecifiedRequired()); assertEquals(false, xmlAttributeMapping.isDefaultRequired()); @@ -234,20 +233,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -258,17 +257,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlAttributeMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlAttributeMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); } public void testUpdateXmlJavaTypeAdapter() throws Exception { @@ -279,7 +278,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -288,20 +287,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -314,17 +313,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlAttributeMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); xmlAttributeMapping.addXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNotNull(xmlAttributeMapping.getXmlSchemaType()); assertNotNull(xmlSchemaTypeAnnotation); xmlAttributeMapping.removeXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); } public void testUpdateXmlSchemaType() throws Exception { @@ -335,7 +334,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlAttributeMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); @@ -344,20 +343,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaTypeAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA_TYPE); } }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNotNull(xmlAttributeMapping.getXmlSchemaType()); assertNotNull(xmlSchemaTypeAnnotation); //remove the XmlSchemaType annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_SCHEMA_TYPE); } }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlAttributeMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); } @@ -378,7 +377,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas } protected Annotation getXmlAttributeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlAttributeAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ATTRIBUTE); } public void testModifyXmlList() throws Exception { @@ -389,17 +388,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlAttributeMapping.getXmlList()); assertNull(xmlListAnnotation); xmlAttributeMapping.addXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNotNull(xmlAttributeMapping.getXmlList()); assertNotNull(xmlListAnnotation); xmlAttributeMapping.removeXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); } public void testUpdateXmlList() throws Exception { @@ -410,7 +409,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlAttributeMapping.getXmlList()); assertNull(xmlListAnnotation); @@ -419,20 +418,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlListAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_LIST); } }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNotNull(xmlAttributeMapping.getXmlList()); assertNotNull(xmlListAnnotation); //remove the XmlList annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlListAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_LIST); } }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlAttributeMapping.getXmlList()); assertNull(xmlListAnnotation); } @@ -445,17 +444,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlAttributeMapping.getXmlID()); assertNull(xmlIDAnnotation); xmlAttributeMapping.addXmlID(); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNotNull(xmlAttributeMapping.getXmlID()); assertNotNull(xmlIDAnnotation); xmlAttributeMapping.removeXmlID(); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); } public void testUpdateXmlID() throws Exception { @@ -466,7 +465,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlAttributeMapping.getXmlID()); assertNull(xmlIDAnnotation); @@ -475,20 +474,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlIDAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ID); } }); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNotNull(xmlAttributeMapping.getXmlID()); assertNotNull(xmlIDAnnotation); //remove the XmlID annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlIDAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_ID); } }); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlAttributeMapping.getXmlID()); assertNull(xmlIDAnnotation); } @@ -501,17 +500,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlAttributeMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); xmlAttributeMapping.addXmlIDREF(); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNotNull(xmlAttributeMapping.getXmlIDREF()); assertNotNull(xmlIDREFAnnotation); xmlAttributeMapping.removeXmlIDREF(); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); } public void testUpdateXmlIDREF() throws Exception { @@ -522,7 +521,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlAttributeMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); @@ -531,20 +530,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlIDREFAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_IDREF); } }); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNotNull(xmlAttributeMapping.getXmlIDREF()); assertNotNull(xmlIDREFAnnotation); //remove the XmlIDREF annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlIDREFAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_IDREF); } }); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlAttributeMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); } @@ -557,17 +556,17 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlAttributeMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); xmlAttributeMapping.addXmlAttachmentRef(); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNotNull(xmlAttributeMapping.getXmlAttachmentRef()); assertNotNull(xmlAttachmentRefAnnotation); xmlAttributeMapping.removeXmlAttachmentRef(); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); } public void testUpdateXmlAttachmentRef() throws Exception { @@ -578,7 +577,7 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlAttributeMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); @@ -587,20 +586,20 @@ public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCas AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttachmentRefAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTACHMENT_REF); } }); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNotNull(xmlAttributeMapping.getXmlAttachmentRef()); assertNotNull(xmlAttachmentRefAnnotation); //remove the XmlAttachmentRef annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlAttachmentRefAnnotation.ANNOTATION_NAME); + GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, JAXB.XML_ATTACHMENT_REF); } }); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlAttributeMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); } 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 14248a1788..6a5f06509d 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 @@ -30,7 +30,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlElement; 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.XmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; 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; @@ -97,14 +96,14 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase assertEquals("id", xmlElement.getQName().getName()); xmlElement.getQName().setSpecifiedName("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertEquals("foo", xmlElementAnnotation.getName()); assertEquals("foo", xmlElement.getQName().getSpecifiedName()); assertEquals("id", xmlElement.getQName().getDefaultName()); assertEquals("foo", xmlElement.getQName().getName()); xmlElement.getQName().setSpecifiedName(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertNull(xmlElementAnnotation.getName()); assertNull(xmlElement.getQName().getSpecifiedName()); } @@ -150,12 +149,12 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase assertNull(xmlElement.getQName().getSpecifiedNamespace()); xmlElement.getQName().setSpecifiedNamespace("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertEquals("foo", xmlElementAnnotation.getNamespace()); assertEquals("foo", xmlElement.getQName().getNamespace()); xmlElement.getQName().setSpecifiedNamespace(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertNull(xmlElementAnnotation.getNamespace()); assertNull(xmlElement.getQName().getSpecifiedNamespace()); } @@ -203,14 +202,14 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase assertEquals(false, xmlElement.isRequired()); xmlElement.setSpecifiedRequired(Boolean.TRUE); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired()); assertEquals(Boolean.TRUE, xmlElement.getSpecifiedRequired()); assertEquals(false, xmlElement.isDefaultRequired()); assertEquals(true, xmlElement.isRequired()); xmlElement.setSpecifiedRequired(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertNull(xmlElementAnnotation.getName()); assertNull(xmlElement.getSpecifiedRequired()); assertEquals(false, xmlElement.isDefaultRequired()); @@ -266,14 +265,14 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase assertEquals(false, xmlElement.isNillable()); xmlElement.setSpecifiedNillable(Boolean.TRUE); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable()); assertEquals(Boolean.TRUE, xmlElement.getSpecifiedNillable()); assertEquals(false, xmlElement.isDefaultNillable()); assertEquals(true, xmlElement.isNillable()); xmlElement.setSpecifiedNillable(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertNull(xmlElementAnnotation.getName()); assertNull(xmlElement.getSpecifiedNillable()); assertEquals(false, xmlElement.isDefaultNillable()); @@ -383,12 +382,12 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase assertNull(xmlElement.getDefaultValue()); xmlElement.setDefaultValue("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertEquals("foo", xmlElementAnnotation.getDefaultValue()); assertEquals("foo", xmlElement.getDefaultValue()); xmlElement.setDefaultValue(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); + xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); assertNull(xmlElementAnnotation.getDefaultValue()); assertNull(xmlElement.getDefaultValue()); } @@ -483,20 +482,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -507,17 +506,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlElementMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlElementMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -530,7 +529,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -539,20 +538,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -565,17 +564,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlElementMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); xmlElementMapping.addXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNotNull(xmlElementMapping.getXmlSchemaType()); assertNotNull(xmlSchemaTypeAnnotation); xmlElementMapping.removeXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); } public void testUpdateXmlSchemaType() throws Exception { @@ -586,7 +585,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlElementMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); @@ -595,20 +594,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaTypeAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_SCHEMA_TYPE); } }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNotNull(xmlElementMapping.getXmlSchemaType()); assertNotNull(xmlSchemaTypeAnnotation); //remove the XmlSchemaType annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_SCHEMA_TYPE); } }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(xmlElementMapping.getXmlSchemaType()); assertNull(xmlSchemaTypeAnnotation); } @@ -629,7 +628,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase } protected Annotation getXmlElementAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlElementAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ELEMENT); } @@ -641,17 +640,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); assertNull(xmlElementMapping.getXmlElementWrapper()); assertNull(xmlElementWrapperAnnotation); xmlElementMapping.addXmlElementWrapper(); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); assertNotNull(xmlElementMapping.getXmlElementWrapper()); assertNotNull(xmlElementWrapperAnnotation); xmlElementMapping.removeXmlElementWrapper(); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); } public void testUpdateXmlElementWrapper() throws Exception { @@ -662,7 +661,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); assertNull(xmlElementMapping.getXmlElementWrapper()); assertNull(xmlElementWrapperAnnotation); @@ -671,20 +670,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlElementWrapperAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ELEMENT_WRAPPER); } }); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); assertNotNull(xmlElementMapping.getXmlElementWrapper()); assertNotNull(xmlElementWrapperAnnotation); //remove the XmlElementWrapper annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlElementWrapperAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_ELEMENT_WRAPPER); } }); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); + xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); assertNull(xmlElementMapping.getXmlElementWrapper()); assertNull(xmlElementWrapperAnnotation); } @@ -697,17 +696,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlElementMapping.getXmlList()); assertNull(xmlListAnnotation); xmlElementMapping.addXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNotNull(xmlElementMapping.getXmlList()); assertNotNull(xmlListAnnotation); xmlElementMapping.removeXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); } public void testUpdateXmlList() throws Exception { @@ -718,7 +717,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlElementMapping.getXmlList()); assertNull(xmlListAnnotation); @@ -727,20 +726,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlListAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_LIST); } }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNotNull(xmlElementMapping.getXmlList()); assertNotNull(xmlListAnnotation); //remove the XmlList annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlListAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_LIST); } }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); + xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); assertNull(xmlElementMapping.getXmlList()); assertNull(xmlListAnnotation); } @@ -753,17 +752,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlElementMapping.getXmlID()); assertNull(xmlIDAnnotation); xmlElementMapping.addXmlID(); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNotNull(xmlElementMapping.getXmlID()); assertNotNull(xmlIDAnnotation); xmlElementMapping.removeXmlID(); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); } public void testUpdateXmlID() throws Exception { @@ -774,7 +773,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlElementMapping.getXmlID()); assertNull(xmlIDAnnotation); @@ -783,20 +782,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlIDAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ID); } }); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNotNull(xmlElementMapping.getXmlID()); assertNotNull(xmlIDAnnotation); //remove the XmlID annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlIDAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_ID); } }); - xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(XmlIDAnnotation.ANNOTATION_NAME); + xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); assertNull(xmlElementMapping.getXmlID()); assertNull(xmlIDAnnotation); } @@ -809,17 +808,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlElementMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); xmlElementMapping.addXmlIDREF(); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNotNull(xmlElementMapping.getXmlIDREF()); assertNotNull(xmlIDREFAnnotation); xmlElementMapping.removeXmlIDREF(); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlElementMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); } @@ -832,7 +831,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlElementMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); @@ -841,20 +840,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlIDREFAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_IDREF); } }); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNotNull(xmlElementMapping.getXmlIDREF()); assertNotNull(xmlIDREFAnnotation); //remove the XmlIDREF annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlIDREFAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_IDREF); } }); - xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(XmlIDREFAnnotation.ANNOTATION_NAME); + xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); assertNull(xmlElementMapping.getXmlIDREF()); assertNull(xmlIDREFAnnotation); } @@ -867,17 +866,17 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlElementMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); xmlElementMapping.addXmlAttachmentRef(); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNotNull(xmlElementMapping.getXmlAttachmentRef()); assertNotNull(xmlAttachmentRefAnnotation); xmlElementMapping.removeXmlAttachmentRef(); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); } public void testUpdateXmlAttachmentRef() throws Exception { @@ -888,7 +887,7 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlElementMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); @@ -897,20 +896,20 @@ public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttachmentRefAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ATTACHMENT_REF); } }); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNotNull(xmlElementMapping.getXmlAttachmentRef()); assertNotNull(xmlAttachmentRefAnnotation); //remove the XmlAttachmentRef annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlAttachmentRefAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, JAXB.XML_ATTACHMENT_REF); } }); - xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(XmlAttachmentRefAnnotation.ANNOTATION_NAME); + xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); assertNull(xmlElementMapping.getXmlAttachmentRef()); assertNull(xmlAttachmentRefAnnotation); } 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 535529a464..e6cbf507f5 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 @@ -27,7 +27,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; import org.eclipse.jpt.jaxb.core.context.XmlElementRef; 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.XmlAttributeAnnotation; 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; @@ -150,13 +149,13 @@ public class GenericJavaXmlElementRefMappingTests assertEquals("", xmlElementRef.getQName().getName()); xmlElementRef.getQName().setSpecifiedName("foo"); - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertEquals("foo", xmlElementRefAnnotation.getName()); assertEquals("foo", xmlElementRef.getQName().getSpecifiedName()); assertEquals("foo", xmlElementRef.getQName().getName()); xmlElementRef.getQName().setSpecifiedName(null); - xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertNull(xmlElementRefAnnotation.getName()); assertNull(xmlElementRef.getQName().getSpecifiedName()); } @@ -202,12 +201,12 @@ public class GenericJavaXmlElementRefMappingTests assertNull(xmlElementRef.getQName().getSpecifiedNamespace()); xmlElementRef.getQName().setSpecifiedNamespace("foo"); - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertEquals("foo", xmlElementRefAnnotation.getNamespace()); assertEquals("foo", xmlElementRef.getQName().getNamespace()); xmlElementRef.getQName().setSpecifiedNamespace(null); - xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertNull(xmlElementRefAnnotation.getNamespace()); assertNull(xmlElementRef.getQName().getSpecifiedNamespace()); } @@ -255,14 +254,14 @@ public class GenericJavaXmlElementRefMappingTests assertEquals(false, xmlElementRef.isRequired()); xmlElementRef.setSpecifiedRequired(Boolean.TRUE); - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertEquals(Boolean.TRUE, xmlElementRefAnnotation.getRequired()); assertEquals(Boolean.TRUE, xmlElementRef.getSpecifiedRequired()); assertEquals(false, xmlElementRef.isDefaultRequired()); assertEquals(true, xmlElementRef.isRequired()); xmlElementRef.setSpecifiedRequired(null); - xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME); + xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF); assertNull(xmlElementRefAnnotation.getName()); assertNull(xmlElementRef.getSpecifiedRequired()); assertEquals(false, xmlElementRef.isDefaultRequired()); @@ -365,20 +364,20 @@ public class GenericJavaXmlElementRefMappingTests JavaResourceAttribute resourceAttribute = xmlElementRefMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlElementRefMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_REF_ATTRIBUTE_MAPPING_KEY); xmlElementRefMapping = (XmlElementRefMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementRefMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementRefAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -389,17 +388,17 @@ public class GenericJavaXmlElementRefMappingTests XmlElementRefMapping xmlElementRefMapping = (XmlElementRefMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementRefMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlElementRefMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlElementRefMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -412,7 +411,7 @@ public class GenericJavaXmlElementRefMappingTests XmlElementRefMapping xmlElementRefMapping = (XmlElementRefMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlElementRefMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -421,20 +420,20 @@ public class GenericJavaXmlElementRefMappingTests AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementRefMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementRefMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementRefMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlElementRefMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlElementRefMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } @@ -455,7 +454,7 @@ public class GenericJavaXmlElementRefMappingTests } protected Annotation getXmlElementRefAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlElementRefAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ELEMENT_REF); } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java index 7241dfd5ac..eed8143249 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java @@ -61,13 +61,13 @@ public class GenericJavaXmlRootElementTests assertEquals("", contextRootElement.getQName().getNamespace()); contextRootElement.getQName().setSpecifiedNamespace("foo"); - XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertEquals("foo", rootElementAnnotation.getNamespace()); assertEquals("foo", contextRootElement.getQName().getSpecifiedNamespace()); assertEquals("foo", contextRootElement.getQName().getNamespace()); contextRootElement.getQName().setSpecifiedNamespace(null); - rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertNull(rootElementAnnotation.getNamespace()); assertNull(contextRootElement.getQName().getSpecifiedNamespace()); assertEquals("", contextRootElement.getQName().getNamespace()); @@ -95,7 +95,7 @@ public class GenericJavaXmlRootElementTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, XmlRootElementAnnotation.ANNOTATION_NAME); + GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, JAXB.XML_ROOT_ELEMENT); } }); contextRootElement = persistentClass.getRootElement(); @@ -114,13 +114,13 @@ public class GenericJavaXmlRootElementTests assertEquals(defaultName, contextRootElement.getQName().getName()); contextRootElement.getQName().setSpecifiedName("foo"); - XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertEquals("foo", rootElementAnnotation.getName()); assertEquals("foo", contextRootElement.getQName().getSpecifiedName()); assertEquals("foo", contextRootElement.getQName().getName()); contextRootElement.getQName().setSpecifiedName(null); - rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); + rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); assertNull(rootElementAnnotation.getName()); assertNull(contextRootElement.getQName().getSpecifiedName()); assertEquals(defaultName, contextRootElement.getQName().getName()); @@ -149,7 +149,7 @@ public class GenericJavaXmlRootElementTests annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, XmlRootElementAnnotation.ANNOTATION_NAME); + GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, JAXB.XML_ROOT_ELEMENT); } }); contextRootElement = persistentClass.getRootElement(); @@ -161,6 +161,6 @@ public class GenericJavaXmlRootElementTests } protected Annotation getXmlRootElementAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlRootElementAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_ROOT_ELEMENT); } } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java index 0fbc619f7f..05f0a4c3a3 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java @@ -28,7 +28,6 @@ import org.eclipse.jpt.jaxb.core.context.XmlNs; import org.eclipse.jpt.jaxb.core.context.XmlNsForm; import org.eclipse.jpt.jaxb.core.context.XmlSchema; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -64,7 +63,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase assertNull(contextXmlSchema.getSpecifiedNamespace()); contextXmlSchema.setSpecifiedNamespace("foo"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals("foo", schemaAnnotation.getNamespace()); assertEquals("foo", contextXmlSchema.getNamespace()); assertEquals("foo", contextXmlSchema.getSpecifiedNamespace()); @@ -72,14 +71,14 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase //set another annotation so the context model is not blown away by removing the XmlSchema annotation contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); contextXmlSchema.setSpecifiedNamespace(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertNull(schemaAnnotation.getNamespace()); assertEquals("", contextXmlSchema.getNamespace()); assertNull(contextXmlSchema.getSpecifiedNamespace()); //set namespace again, this time starting with no XmlSchema annotation contextXmlSchema.setSpecifiedNamespace("foo"); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals("foo", schemaAnnotation.getNamespace()); assertEquals("foo", contextXmlSchema.getSpecifiedNamespace()); assertEquals("foo", contextXmlSchema.getNamespace()); @@ -123,20 +122,20 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase assertNull(contextXmlSchema.getLocation()); contextXmlSchema.setLocation("foo"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals("foo", schemaAnnotation.getLocation()); assertEquals("foo", contextXmlSchema.getLocation()); //set another annotation so the context model is not blown away by removing the XmlSchema annotation contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); contextXmlSchema.setLocation(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertNull(schemaAnnotation.getLocation()); assertNull(contextXmlSchema.getLocation()); //set location again, this time starting with no XmlSchema annotation contextXmlSchema.setLocation("foo"); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals("foo", schemaAnnotation.getLocation()); assertEquals("foo", contextXmlSchema.getLocation()); } @@ -178,7 +177,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase assertEquals(XmlNsForm.UNSET, contextXmlSchema.getAttributeFormDefault()); contextXmlSchema.setSpecifiedAttributeFormDefault(XmlNsForm.QUALIFIED); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getAttributeFormDefault()); @@ -189,13 +188,13 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase //set another annotation so the context model is not blown away by removing the XmlSchema annotation contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); contextXmlSchema.setSpecifiedAttributeFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertNull(schemaAnnotation.getAttributeFormDefault()); assertNull(contextXmlSchema.getSpecifiedAttributeFormDefault()); //set attribute form default again, this time starting with no XmlSchema annotation contextXmlSchema.setSpecifiedAttributeFormDefault(XmlNsForm.QUALIFIED); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getAttributeFormDefault()); } @@ -257,7 +256,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase assertEquals(XmlNsForm.UNSET, contextXmlSchema.getElementFormDefault()); contextXmlSchema.setSpecifiedElementFormDefault(XmlNsForm.QUALIFIED); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getElementFormDefault()); @@ -268,13 +267,13 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase //set another annotation so the context model is not blown away by removing the XmlSchema annotation contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); contextXmlSchema.setSpecifiedElementFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertNull(schemaAnnotation.getElementFormDefault()); assertNull(contextXmlSchema.getSpecifiedElementFormDefault()); //set element form default again, this time starting with no XmlSchema annotation contextXmlSchema.setSpecifiedElementFormDefault(XmlNsForm.QUALIFIED); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getElementFormDefault()); } @@ -405,7 +404,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase xmlNsPrefix.setNamespaceURI("baz"); xmlNsPrefix.setPrefix("bazPrefix"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); ListIterator<XmlNsAnnotation> xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); XmlNsAnnotation xmlNsAnnotation = xmlNsPrefixes.next(); @@ -436,7 +435,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase xmlNsPrefix.setNamespaceURI("baz"); xmlNsPrefix.setPrefix("bazPrefix"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); ListIterator<XmlNsAnnotation> xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); XmlNsAnnotation xmlNsAnnotation = xmlNsPrefixes.next(); @@ -461,7 +460,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase contextXmlSchema.addXmlNsPrefix(1).setNamespaceURI("foo"); contextXmlSchema.addXmlNsPrefix(2).setNamespaceURI("baz"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(3, schemaAnnotation.getXmlnsSize()); contextXmlSchema.removeXmlNsPrefix(1); @@ -492,7 +491,7 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase contextXmlSchema.addXmlNsPrefix(2).setNamespaceURI("baz"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(JAXB.XML_SCHEMA); assertEquals(3, schemaAnnotation.getXmlnsSize()); @@ -652,12 +651,12 @@ public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase //add another package annotation so that the context model object doesn't get removed when //removing the XmlSchema annotation. Only "annotated" packages are added to the context model protected void removeXmlSchemaAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlSchemaAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ACCESSOR_ORDER); + this.removeAnnotation(declaration, JAXB.XML_SCHEMA); } protected Annotation getXmlSchemaAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlSchemaAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_SCHEMA); } protected void moveXmlNsPrefix(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java index c6f74abf93..412482cabb 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java @@ -21,7 +21,6 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; import org.eclipse.xsd.util.XSDUtil; @@ -50,13 +49,13 @@ public class GenericJavaXmlSchemaTypeTests extends JaxbContextModelTestCase assertNull(contextXmlSchemaType.getQName().getName()); contextXmlSchemaType.getQName().setSpecifiedName("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertEquals("foo", schemaTypeAnnotation.getName()); assertEquals("foo", contextXmlSchemaType.getQName().getName()); //verify the xml schema type annotation is not removed when the name is set to null contextXmlSchemaType.getQName().setSpecifiedName(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(schemaTypeAnnotation.getName()); assertNull(contextXmlSchemaType.getQName().getName()); } @@ -97,14 +96,14 @@ public class GenericJavaXmlSchemaTypeTests extends JaxbContextModelTestCase assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getQName().getNamespace()); contextXmlSchemaType.getQName().setSpecifiedNamespace("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertEquals("foo", schemaTypeAnnotation.getNamespace()); assertEquals("foo", contextXmlSchemaType.getQName().getSpecifiedNamespace()); assertEquals("foo", contextXmlSchemaType.getQName().getNamespace()); //verify the xml schema type annotation is not removed when the namespace is set to null contextXmlSchemaType.getQName().setSpecifiedNamespace(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(schemaTypeAnnotation.getNamespace()); assertNull(contextXmlSchemaType.getQName().getSpecifiedNamespace()); assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getQName().getNamespace()); @@ -147,13 +146,13 @@ public class GenericJavaXmlSchemaTypeTests extends JaxbContextModelTestCase assertNull(contextXmlSchemaType.getType()); contextXmlSchemaType.setType("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertEquals("foo", schemaTypeAnnotation.getType()); assertEquals("foo", contextXmlSchemaType.getType()); //verify the xml schema type annotation is not removed when the type is set to null contextXmlSchemaType.setType(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); assertNull(schemaTypeAnnotation.getType()); assertNull(contextXmlSchemaType.getType()); } @@ -197,11 +196,11 @@ public class GenericJavaXmlSchemaTypeTests extends JaxbContextModelTestCase //add another package annotation so that the context model object doesn't get removed when //removing the XmlSchemaType annotation. Only "annotated" packages are added to the context model protected void removeXmlSchemaTypeAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); + this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ACCESSOR_ORDER); + this.removeAnnotation(declaration, JAXB.XML_SCHEMA_TYPE); } protected Annotation getXmlSchemaTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlSchemaTypeAnnotation.ANNOTATION_NAME); + return declaration.getAnnotationNamed(JAXB.XML_SCHEMA_TYPE); } } 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 8f748f295d..439d54e059 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 @@ -24,10 +24,7 @@ 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.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; @@ -65,32 +62,32 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase JavaResourceAttribute resourceAttribute = xmlValueMapping.getPersistentAttribute().getJavaResourceAttribute(); assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_VALUE)); persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_VALUE)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY); xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_VALUE)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE)); persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_VALUE)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); persistentAttribute.setMappingKey(MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY); xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); + assertNotNull(resourceAttribute.getAnnotation(JAXB.XML_VALUE)); + assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT)); } public void testModifyXmlJavaTypeAdapter() throws Exception { @@ -101,17 +98,17 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlValueMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); xmlValueMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); xmlValueMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); } public void testUpdateXmlJavaTypeAdapter() throws Exception { @@ -122,7 +119,7 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); JavaResourceAttribute resourceAttribute = xmlValueMapping.getPersistentAttribute().getJavaResourceAttribute(); - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); @@ -131,20 +128,20 @@ public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlValueMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlValueMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter()); assertNotNull(xmlJavaTypeAdapterAnnotation); //remove the XmlJavaTypeAdapter annotation annotatedElement.edit(new Member.Editor() { public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlValueMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + GenericJavaXmlValueMappingTests.this.removeAnnotation(declaration, JAXB.XML_JAVA_TYPE_ADAPTER); } }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); + xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); assertNull(xmlJavaTypeAdapterAnnotation); } diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java index 1128885d56..9a4bbd2ab3 100644 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java +++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java @@ -104,7 +104,7 @@ public class XmlSchemaAnnotationTests assertNull(schemaAnnotation.getAttributeFormDefault()); assertSourceDoesNotContain("@XmlSchema(", cu); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA); schemaAnnotation.setAttributeFormDefault(XmlNsForm.QUALIFIED); assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); assertSourceContains("@XmlSchema(attributeFormDefault = QUALIFIED)", cu); @@ -134,7 +134,7 @@ public class XmlSchemaAnnotationTests assertNull(schemaAnnotation.getElementFormDefault()); assertSourceDoesNotContain("@XmlSchema(", cu); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA); schemaAnnotation.setElementFormDefault(XmlNsForm.QUALIFIED); assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); assertSourceContains("@XmlSchema(elementFormDefault = QUALIFIED)", cu); @@ -154,7 +154,7 @@ public class XmlSchemaAnnotationTests assertNull(schemaAnnotation.getLocation()); assertSourceDoesNotContain("@XmlSchema(", cu); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA); schemaAnnotation.setLocation(TEST_LOCATION); assertEquals(TEST_LOCATION, schemaAnnotation.getLocation()); assertSourceContains("@XmlSchema(location = \"" + TEST_LOCATION + "\")", cu); @@ -174,7 +174,7 @@ public class XmlSchemaAnnotationTests assertNull(schemaAnnotation.getNamespace()); assertSourceDoesNotContain("@XmlSchema(", cu); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); + schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA); schemaAnnotation.setNamespace(TEST_NAMESPACE); assertEquals(TEST_NAMESPACE, schemaAnnotation.getNamespace()); assertSourceContains("@XmlSchema(namespace = \"" + TEST_NAMESPACE + "\")", cu); |