327915 - JAXB attribute level annotation resource model support
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbAnnotationDefinitionProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbAnnotationDefinitionProvider.java
index 6e2840f..65d0379 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbAnnotationDefinitionProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbAnnotationDefinitionProvider.java
@@ -15,15 +15,28 @@
import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAccessorOrderAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAccessorTypeAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAnyAttributeAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAttachmentRefAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementRefAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementRefsAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementsAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlEnumAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlEnumValueAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlIDAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlIDREFAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlInlineBinaryDataAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlJavaTypeAdapterAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlJavaTypeAdaptersAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlListAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlMimeTypeAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlMixedAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlRegistryAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlRootElementAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlSeeAlsoAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlTransientAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlTypeAnnotationDefinition;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlValueAnnotationDefinition;
/**
* Support for JAXB annotations
@@ -84,9 +97,22 @@
@Override
protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ definitions.add(XmlAnyAttributeAnnotationDefinition.instance());
+ definitions.add(XmlAttachmentRefAnnotationDefinition.instance());
+ definitions.add(XmlElementAnnotationDefinition.instance());
+ definitions.add(XmlElementsAnnotationDefinition.instance());
+ definitions.add(XmlElementRefAnnotationDefinition.instance());
+ definitions.add(XmlElementRefsAnnotationDefinition.instance());
+ definitions.add(XmlEnumValueAnnotationDefinition.instance());
+ definitions.add(XmlIDAnnotationDefinition.instance());
+ definitions.add(XmlIDREFAnnotationDefinition.instance());
definitions.add(XmlInlineBinaryDataAnnotationDefinition.instance());
definitions.add(XmlJavaTypeAdapterAnnotationDefinition.instance());
definitions.add(XmlJavaTypeAdaptersAnnotationDefinition.instance());
+ definitions.add(XmlListAnnotationDefinition.instance());
+ definitions.add(XmlMimeTypeAnnotationDefinition.instance());
+ definitions.add(XmlMixedAnnotationDefinition.instance());
definitions.add(XmlTransientAnnotationDefinition.instance());
+ definitions.add(XmlValueAnnotationDefinition.instance());
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java
new file mode 100644
index 0000000..1717bb5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAnyAttributeAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAnyAttributeAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAnyAttribute
+ */
+public final class XmlAnyAttributeAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlAnyAttributeAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlAnyAttributeAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlAnyAttributeAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlAnyAttributeAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlAnyAttributeAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java
new file mode 100644
index 0000000..f0677a5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAttachmentRefAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAttachmentRefAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAttachmentRef
+ */
+public final class XmlAttachmentRefAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlAttachmentRefAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlAttachmentRefAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlAttachmentRefAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlAttachmentRefAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlAttachmentRefAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java
new file mode 100644
index 0000000..f732855
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElement
+ */
+public final class XmlElementAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlElementAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlElementAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlElementAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlElementAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlElementAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java
new file mode 100644
index 0000000..29971b9
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementRefAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementRefAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElementRef
+ */
+public final class XmlElementRefAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlElementRefAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlElementRefAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlElementRefAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlElementRefAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlElementRefAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefsAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefsAnnotationDefinition.java
new file mode 100644
index 0000000..a0e6826
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefsAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementRefsAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementRefsAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElementRefs
+ */
+public final class XmlElementRefsAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlElementRefsAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlElementRefsAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlElementRefsAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlElementRefsAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlElementRefsAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java
new file mode 100644
index 0000000..4bd0e95
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementsAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementsAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElements
+ */
+public final class XmlElementsAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlElementsAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlElementsAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlElementsAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlElementsAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlElementsAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java
new file mode 100644
index 0000000..e0a6d78
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlEnumValueAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlEnumValueAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlEnumValue
+ */
+public final class XmlEnumValueAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlEnumValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlEnumValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlEnumValueAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlEnumValueAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlEnumValueAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java
new file mode 100644
index 0000000..c02bfc1
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlIDAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlID
+ */
+public final class XmlIDAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlIDAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlIDAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlIDAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlIDAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlIDAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java
new file mode 100644
index 0000000..657b38b
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlIDREFAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDREFAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlIDREF
+ */
+public final class XmlIDREFAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlIDREFAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlIDREFAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlIDREFAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlIDREFAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlIDREFAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java
new file mode 100644
index 0000000..f7d5487
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlListAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlListAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlList
+ */
+public final class XmlListAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlListAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlListAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlListAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlListAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlListAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java
new file mode 100644
index 0000000..b206944
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlMimeTypeAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMimeTypeAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMimeType
+ */
+public final class XmlMimeTypeAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlMimeTypeAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlMimeTypeAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlMimeTypeAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlMimeTypeAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlMimeTypeAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java
new file mode 100644
index 0000000..0b6474f
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlMixedAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMixedAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMixed
+ */
+public final class XmlMixedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlMixedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlMixedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlMixedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlMixedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlMixedAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java
new file mode 100644
index 0000000..d626a13
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlValueAnnotation;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlValueAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlValue
+ */
+public final class XmlValueAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new XmlValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private XmlValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceXmlValueAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryXmlValueAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return XmlValueAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java
new file mode 100644
index 0000000..da18569
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAnyAttribute
+ */
+public final class BinaryXmlAnyAttributeAnnotation
+ extends BinaryAnnotation
+ implements XmlAnyAttributeAnnotation
+{
+
+ public BinaryXmlAnyAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java
new file mode 100644
index 0000000..774abad
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAttachmentRef
+ */
+public final class BinaryXmlAttachmentRefAnnotation
+ extends BinaryAnnotation
+ implements XmlAttachmentRefAnnotation
+{
+
+ public BinaryXmlAttachmentRefAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java
new file mode 100644
index 0000000..1c1089f
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElement
+ */
+public final class BinaryXmlElementAnnotation
+ extends BinaryAnnotation
+ implements XmlElementAnnotation
+{
+ private String name;
+ private String namespace;
+ private String defaultValue;
+ private Boolean nillable;
+ private Boolean required;
+ private String type;
+
+
+ public BinaryXmlElementAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.namespace = this.buildNamespace();
+ this.defaultValue = this.buildDefaultValue();
+ this.nillable = this.buildNillable();
+ this.required = this.buildRequired();
+ this.type = this.buildType();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setNamespace_(this.buildNamespace());
+ this.setDefaultValue_(this.buildDefaultValue());
+ this.setNillable_(this.buildNillable());
+ this.setRequired_(this.buildRequired());
+ this.setType_(this.buildType());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** XmlElementAnnotation implementation **********
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAME);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** namespace
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setNamespace_(String namespace) {
+ String old = this.namespace;
+ this.namespace = namespace;
+ this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace);
+ }
+
+ private String buildNamespace() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAMESPACE);
+ }
+
+ public TextRange getNamespaceTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** default value
+ public String getDefaultValue() {
+ return this.defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDefaultValue_(String defaultValue) {
+ String old = this.defaultValue;
+ this.defaultValue = defaultValue;
+ this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue);
+ }
+
+ private String buildDefaultValue() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__DEFAULT_VALUE);
+ }
+
+ public TextRange getDefaultValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** nillable
+ public Boolean getNillable() {
+ return this.nillable;
+ }
+
+ public void setNillable(Boolean nillable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setNillable_(Boolean nillable) {
+ Boolean old = this.nillable;
+ this.nillable = nillable;
+ this.firePropertyChanged(NILLABLE_PROPERTY, old, nillable);
+ }
+
+ private Boolean buildNillable() {
+ return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__NILLABLE);
+ }
+
+ public TextRange getNillableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** required
+ public Boolean getRequired() {
+ return this.required;
+ }
+
+ public void setRequired(Boolean required) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setRequired_(Boolean required) {
+ Boolean old = this.required;
+ this.required = required;
+ this.firePropertyChanged(REQUIRED_PROPERTY, old, required);
+ }
+
+ private Boolean buildRequired() {
+ return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__REQUIRED);
+ }
+
+ public TextRange getRequiredTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** type
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setType_(String type) {
+ String old = this.type;
+ this.type = type;
+ this.firePropertyChanged(TYPE_PROPERTY, old, type);
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type);
+ }
+
+ private String buildType() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__TYPE);
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified type name
+ public String getFullyQualifiedTypeName() {
+ return this.type;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java
new file mode 100644
index 0000000..44b0229
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElementRef
+ */
+public final class BinaryXmlElementRefAnnotation
+ extends BinaryAnnotation
+ implements XmlElementRefAnnotation
+{
+ private String name;
+ private String namespace;
+ private String type;
+
+
+ public BinaryXmlElementRefAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.namespace = this.buildNamespace();
+ this.type = this.buildType();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setNamespace_(this.buildNamespace());
+ this.setType_(this.buildType());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** XmlElementRefAnnotation implementation **********
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAME);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** namespace
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setNamespace_(String namespace) {
+ String old = this.namespace;
+ this.namespace = namespace;
+ this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace);
+ }
+
+ private String buildNamespace() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAMESPACE);
+ }
+
+ public TextRange getNamespaceTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** type
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setType_(String type) {
+ String old = this.type;
+ this.type = type;
+ this.firePropertyChanged(TYPE_PROPERTY, old, type);
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type);
+ }
+
+ private String buildType() {
+ return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__TYPE);
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified type name
+ public String getFullyQualifiedTypeName() {
+ return this.type;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefsAnnotation.java
new file mode 100644
index 0000000..9760ab4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefsAnnotation.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryContainerAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+
+/**
+ * javax.xml.bind.annotation.adapters.XmlElementRefs
+ */
+public class BinaryXmlElementRefsAnnotation
+ extends BinaryContainerAnnotation<XmlElementRefAnnotation>
+ implements XmlElementRefsAnnotation {
+
+ private final Vector<XmlElementRefAnnotation> xmlElementRefs;
+
+
+ public BinaryXmlElementRefsAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.xmlElementRefs = this.buildXmlElementRefs();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<XmlElementRefAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<XmlElementRefAnnotation>(this.xmlElementRefs);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.xmlElementRefs.size();
+ }
+
+ private Vector<XmlElementRefAnnotation> buildXmlElementRefs() {
+ Object[] jdtElementRefs = this.getJdtMemberValues(JAXB.XML_ELEMENT_REFS__VALUE);
+ Vector<XmlElementRefAnnotation> result = new Vector<XmlElementRefAnnotation>(jdtElementRefs.length);
+ for (Object jdtElementRef : jdtElementRefs) {
+ result.add(this.buildXmlElementRefAnnotation(jdtElementRef));
+ }
+ return result;
+ }
+
+ protected XmlElementRefAnnotation buildXmlElementRefAnnotation(Object jdtElementRef) {
+ return new BinaryXmlElementRefAnnotation(this, (IAnnotation) jdtElementRef);
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateXmlElementRefs();
+ }
+
+ // TODO
+ private void updateXmlElementRefs() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java
new file mode 100644
index 0000000..0d382b3
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryContainerAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+
+/**
+ * javax.xml.bind.annotation.adapters.XmlElements
+ */
+public class BinaryXmlElementsAnnotation
+ extends BinaryContainerAnnotation<XmlElementAnnotation>
+ implements XmlElementsAnnotation {
+
+ private final Vector<XmlElementAnnotation> xmlElements;
+
+
+ public BinaryXmlElementsAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.xmlElements = this.buildXmlElements();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<XmlElementAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<XmlElementAnnotation>(this.xmlElements);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.xmlElements.size();
+ }
+
+ private Vector<XmlElementAnnotation> buildXmlElements() {
+ Object[] jdtElements = this.getJdtMemberValues(JAXB.XML_ELEMENTS__VALUE);
+ Vector<XmlElementAnnotation> result = new Vector<XmlElementAnnotation>(jdtElements.length);
+ for (Object jdtElement : jdtElements) {
+ result.add(this.buildXmlElementAnnotation(jdtElement));
+ }
+ return result;
+ }
+
+ protected XmlElementAnnotation buildXmlElementAnnotation(Object jdtElement) {
+ return new BinaryXmlElementAnnotation(this, (IAnnotation) jdtElement);
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateXmlElements();
+ }
+
+ // TODO
+ private void updateXmlElements() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java
new file mode 100644
index 0000000..81835ac
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlEnumValue
+ */
+public final class BinaryXmlEnumValueAnnotation
+ extends BinaryAnnotation
+ implements XmlEnumValueAnnotation
+{
+
+ public BinaryXmlEnumValueAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java
new file mode 100644
index 0000000..72a679b
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlID
+ */
+public final class BinaryXmlIDAnnotation
+ extends BinaryAnnotation
+ implements XmlIDAnnotation
+{
+
+ public BinaryXmlIDAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java
new file mode 100644
index 0000000..85e4596
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlIDREF
+ */
+public final class BinaryXmlIDREFAnnotation
+ extends BinaryAnnotation
+ implements XmlIDREFAnnotation
+{
+
+ public BinaryXmlIDREFAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdaptersAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdaptersAnnotation.java
index 7e86122..e88c9cb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdaptersAnnotation.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdaptersAnnotation.java
@@ -12,7 +12,7 @@
import java.util.Vector;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jpt.core.internal.resource.java.binary.BinaryContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdaptersAnnotation;
@@ -28,7 +28,7 @@
private final Vector<XmlJavaTypeAdapterAnnotation> xmlJavaTypeAdapters;
- public BinaryXmlJavaTypeAdaptersAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ public BinaryXmlJavaTypeAdaptersAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.xmlJavaTypeAdapters = this.buildXmlJavaTypeAdapters();
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java
new file mode 100644
index 0000000..b190956
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlList
+ */
+public final class BinaryXmlListAnnotation
+ extends BinaryAnnotation
+ implements XmlListAnnotation
+{
+
+ public BinaryXmlListAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java
new file mode 100644
index 0000000..6dd6cc9
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMimeType
+ */
+public final class BinaryXmlMimeTypeAnnotation
+ extends BinaryAnnotation
+ implements XmlMimeTypeAnnotation
+{
+
+ public BinaryXmlMimeTypeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java
new file mode 100644
index 0000000..e77b127
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMixed
+ */
+public final class BinaryXmlMixedAnnotation
+ extends BinaryAnnotation
+ implements XmlMixedAnnotation
+{
+
+ public BinaryXmlMixedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java
new file mode 100644
index 0000000..83e8064
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlValue
+ */
+public final class BinaryXmlValueAnnotation
+ extends BinaryAnnotation
+ implements XmlValueAnnotation
+{
+
+ public BinaryXmlValueAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java
new file mode 100644
index 0000000..5c0b1a5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAnyAttribute
+ */
+public final class SourceXmlAnyAttributeAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlAnyAttributeAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlAnyAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java
new file mode 100644
index 0000000..a120bae
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlAttachmentRef
+ */
+public final class SourceXmlAttachmentRefAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlAttachmentRefAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlAttachmentRefAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java
new file mode 100644
index 0000000..d4d5b75
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java
@@ -0,0 +1,378 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElement
+ */
+public final class SourceXmlElementAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlElementAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private String fullyQualifiedTypeName;
+
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private final AnnotationElementAdapter<String> nameAdapter;
+ private String name;
+
+ private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter;
+ private final AnnotationElementAdapter<String> namespaceAdapter;
+ private String namespace;
+
+ private final DeclarationAnnotationElementAdapter<Boolean> nillableDeclarationAdapter;
+ private final AnnotationElementAdapter<Boolean> nillableAdapter;
+ private Boolean nillable;
+
+ private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter;
+ private final AnnotationElementAdapter<Boolean> requiredAdapter;
+ private Boolean required;
+
+ private final DeclarationAnnotationElementAdapter<String> defaultValueDeclarationAdapter;
+ private final AnnotationElementAdapter<String> defaultValueAdapter;
+ private String defaultValue;
+
+ private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter;
+ private final AnnotationElementAdapter<String> typeAdapter;
+ private String type;
+
+ // ********** constructors **********
+ public SourceXmlElementAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ /**
+ * Parent is a JavaResourceNode instead of a JavaResourcePersistentAttribute because
+ * the parent is sometimes the outer annotation XmlElementsAnnotation
+ */
+ public SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, attribute, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameAdapter(daa);
+ this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter);
+ this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa);
+ this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter);
+ this.nillableDeclarationAdapter = this.buildNillableAdapter(daa);
+ this.nillableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nillableDeclarationAdapter);
+ this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa);
+ this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter);
+ this.defaultValueDeclarationAdapter = this.buildDefaultValueAdapter(daa);
+ this.defaultValueAdapter = this.buildAnnotationElementAdapter(this.defaultValueDeclarationAdapter);
+ this.typeDeclarationAdapter = this.buildTypeAdapter(daa);
+ this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAME, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAMESPACE, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildNillableAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__NILLABLE, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildRequiredAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__REQUIRED, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildDefaultValueAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__DEFAULT_VALUE, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) {
+ return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT__TYPE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, converter);
+ }
+
+ private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.namespace = this.buildNamespace(astRoot);
+ this.nillable = this.buildNillable(astRoot);
+ this.required = this.buildRequired(astRoot);
+ this.defaultValue = this.buildDefaultValue(astRoot);
+ this.type = this.buildType(astRoot);
+ this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncNamespace(this.buildNamespace(astRoot));
+ this.syncNillable(this.buildNillable(astRoot));
+ this.syncRequired(this.buildRequired(astRoot));
+ this.syncDefaultValue(this.buildDefaultValue(astRoot));
+ this.syncType(this.buildType(astRoot));
+ this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** XmlElementAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ // ***** namespace
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ if (this.attributeValueHasChanged(this.namespace, namespace)) {
+ this.namespace = namespace;
+ this.namespaceAdapter.setValue(namespace);
+ }
+ }
+
+ private void syncNamespace(String astNamespace) {
+ String old = this.namespace;
+ this.namespace = astNamespace;
+ this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace);
+ }
+
+ private String buildNamespace(CompilationUnit astRoot) {
+ return this.namespaceAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNamespaceTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot);
+ }
+
+ // ***** nillable
+ public Boolean getNillable() {
+ return this.nillable;
+ }
+
+ public void setNillable(Boolean nillable) {
+ if (this.attributeValueHasChanged(this.nillable, nillable)) {
+ this.nillable = nillable;
+ this.nillableAdapter.setValue(nillable);
+ }
+ }
+
+ private void syncNillable(Boolean astNillable) {
+ Boolean old = this.nillable;
+ this.nillable = astNillable;
+ this.firePropertyChanged(NILLABLE_PROPERTY, old, astNillable);
+ }
+
+ private Boolean buildNillable(CompilationUnit astRoot) {
+ return this.nillableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNillableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nillableDeclarationAdapter, astRoot);
+ }
+
+ // ***** required
+ public Boolean getRequired() {
+ return this.required;
+ }
+
+ public void setRequired(Boolean required) {
+ if (this.attributeValueHasChanged(this.required, required)) {
+ this.required = required;
+ this.requiredAdapter.setValue(required);
+ }
+ }
+
+ private void syncRequired(Boolean astRequired) {
+ Boolean old = this.required;
+ this.required = astRequired;
+ this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired);
+ }
+
+ private Boolean buildRequired(CompilationUnit astRoot) {
+ return this.requiredAdapter.getValue(astRoot);
+ }
+
+ public TextRange getRequiredTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot);
+ }
+
+ // ***** defaultValue
+ public String getDefaultValue() {
+ return this.defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ if (this.attributeValueHasChanged(this.defaultValue, defaultValue)) {
+ this.defaultValue = defaultValue;
+ this.defaultValueAdapter.setValue(defaultValue);
+ }
+ }
+
+ private void syncDefaultValue(String astDefaultValue) {
+ String old = this.defaultValue;
+ this.defaultValue = astDefaultValue;
+ this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, astDefaultValue);
+ }
+
+ private String buildDefaultValue(CompilationUnit astRoot) {
+ return this.defaultValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDefaultValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.defaultValueDeclarationAdapter, astRoot);
+ }
+
+ // ***** type
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ if (this.attributeValueHasChanged(this.type, type)) {
+ this.type = type;
+ this.typeAdapter.setValue(type);
+ }
+ }
+
+ private void syncType(String astType) {
+ String old = this.type;
+ this.type = astType;
+ this.firePropertyChanged(TYPE_PROPERTY, old, astType);
+ }
+
+ private String buildType(CompilationUnit astRoot) {
+ return this.typeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.typeDeclarationAdapter, astRoot);
+ }
+
+ // ***** fully-qualified type name
+ public String getFullyQualifiedTypeName() {
+ return this.fullyQualifiedTypeName;
+ }
+
+ private void syncFullyQualifiedTypeName(String name) {
+ String old = this.fullyQualifiedTypeName;
+ this.fullyQualifiedTypeName = name;
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name);
+ }
+
+ private String buildFullyQualifiedTypeName(CompilationUnit astRoot) {
+ return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot));
+ }
+
+
+ //*********** NestableAnnotation implementation ****************
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ XmlElementAnnotation oldXmlElementAnnotation = (XmlElementAnnotation) oldAnnotation;
+ this.setName(oldXmlElementAnnotation.getName());
+ this.setNamespace(oldXmlElementAnnotation.getNamespace());
+ this.setDefaultValue (oldXmlElementAnnotation.getDefaultValue());
+ this.setNillable(oldXmlElementAnnotation.getNillable());
+ this.setRequired(oldXmlElementAnnotation.getRequired());
+ this.setType(oldXmlElementAnnotation.getType());
+ }
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ // ********** static methods **********
+
+ static SourceXmlElementAnnotation createNestedXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter elementsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, elementsAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa);
+
+ return new SourceXmlElementAnnotation(parent, attribute, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter elementsAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(elementsAdapter, index, JAXB.XML_ELEMENT);
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java
new file mode 100644
index 0000000..2c15711
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlElementRef
+ */
+public final class SourceXmlElementRefAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlElementRefAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private String fullyQualifiedTypeName;
+
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private final AnnotationElementAdapter<String> nameAdapter;
+ private String name;
+
+ private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter;
+ private final AnnotationElementAdapter<String> namespaceAdapter;
+ private String namespace;
+
+ private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter;
+ private final AnnotationElementAdapter<String> typeAdapter;
+ private String type;
+
+ // ********** constructors **********
+ public SourceXmlElementRefAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ /**
+ * Parent is a JavaResourceNode instead of a JavaResourcePersistentAttribute because
+ * the parent is sometimes the outer annotation XmlElementRefsAnnotation
+ */
+ public SourceXmlElementRefAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, attribute, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameAdapter(daa);
+ this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter);
+ this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa);
+ this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter);
+ this.typeDeclarationAdapter = this.buildTypeAdapter(daa);
+ this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAME, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAMESPACE, false); // false = do not remove annotation when empty
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) {
+ return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT_REF__TYPE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, converter);
+ }
+
+ private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.namespace = this.buildNamespace(astRoot);
+ this.type = this.buildType(astRoot);
+ this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncNamespace(this.buildNamespace(astRoot));
+ this.syncType(this.buildType(astRoot));
+ this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** XmlElementRefAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ // ***** namespace
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ if (this.attributeValueHasChanged(this.namespace, namespace)) {
+ this.namespace = namespace;
+ this.namespaceAdapter.setValue(namespace);
+ }
+ }
+
+ private void syncNamespace(String astNamespace) {
+ String old = this.namespace;
+ this.namespace = astNamespace;
+ this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace);
+ }
+
+ private String buildNamespace(CompilationUnit astRoot) {
+ return this.namespaceAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNamespaceTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot);
+ }
+
+ // ***** type
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ if (this.attributeValueHasChanged(this.type, type)) {
+ this.type = type;
+ this.typeAdapter.setValue(type);
+ }
+ }
+
+ private void syncType(String astType) {
+ String old = this.type;
+ this.type = astType;
+ this.firePropertyChanged(TYPE_PROPERTY, old, astType);
+ }
+
+ private String buildType(CompilationUnit astRoot) {
+ return this.typeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.typeDeclarationAdapter, astRoot);
+ }
+
+ // ***** fully-qualified type name
+ public String getFullyQualifiedTypeName() {
+ return this.fullyQualifiedTypeName;
+ }
+
+ private void syncFullyQualifiedTypeName(String name) {
+ String old = this.fullyQualifiedTypeName;
+ this.fullyQualifiedTypeName = name;
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name);
+ }
+
+ private String buildFullyQualifiedTypeName(CompilationUnit astRoot) {
+ return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot));
+ }
+
+
+ //*********** NestableAnnotation implementation ****************
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ XmlElementRefAnnotation oldXmlElementRefAnnotation = (XmlElementRefAnnotation) oldAnnotation;
+ this.setName(oldXmlElementRefAnnotation.getName());
+ this.setNamespace(oldXmlElementRefAnnotation.getNamespace());
+ this.setType(oldXmlElementRefAnnotation.getType());
+ }
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ // ********** static methods **********
+
+ static SourceXmlElementRefAnnotation createNestedXmlElementRefAnnotation(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter elementsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, elementsAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa);
+
+ return new SourceXmlElementRefAnnotation(parent, attribute, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter elementsAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(elementsAdapter, index, JAXB.XML_ELEMENT_REF);
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefsAnnotation.java
new file mode 100644
index 0000000..2332593
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefsAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+
+/**
+ * javax.xml.bind.annotation.adapters.XmlElementRefs
+ */
+public class SourceXmlElementRefsAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlElementRefsAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<XmlElementRefAnnotation> elementRefs = new Vector<XmlElementRefAnnotation>();
+
+
+ public SourceXmlElementRefsAnnotation(JavaResourcePersistentAttribute parent, Attribute attibute) {
+ super(parent, attibute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.elementRefs);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JAXB.XML_ELEMENT_REFS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return XmlElementRefAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<XmlElementRefAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<XmlElementRefAnnotation>(this.elementRefs);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.elementRefs.size();
+ }
+
+ public XmlElementRefAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.elementRefs.size());
+ }
+
+ private XmlElementRefAnnotation addNestedAnnotation(int index) {
+ XmlElementRefAnnotation elementRef = this.buildXmlElementRefAnnotation(index);
+ this.elementRefs.add(elementRef);
+ return elementRef;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.elementRefs.size();
+ XmlElementRefAnnotation elementRef = this.addNestedAnnotation(index);
+ elementRef.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(XML_ELEMENT_REFS_LIST, index, elementRef);
+ }
+
+ protected XmlElementRefAnnotation buildXmlElementRefAnnotation(int index) {
+ return SourceXmlElementRefAnnotation.createNestedXmlElementRefAnnotation(this, this.annotatedElement, index, this.daa);
+ }
+
+ public XmlElementRefAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.elementRefs, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public XmlElementRefAnnotation removeNestedAnnotation(int index) {
+ return this.elementRefs.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.elementRefs, XML_ELEMENT_REFS_LIST);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java
new file mode 100644
index 0000000..3d5ac6c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+
+/**
+ * javax.xml.bind.annotation.adapters.XmlElements
+ */
+public class SourceXmlElementsAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlElementsAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<XmlElementAnnotation> elements = new Vector<XmlElementAnnotation>();
+
+
+ public SourceXmlElementsAnnotation(JavaResourcePersistentAttribute parent, Attribute attibute) {
+ super(parent, attibute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.elements);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JAXB.XML_ELEMENTS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return XmlElementAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<XmlElementAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<XmlElementAnnotation>(this.elements);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.elements.size();
+ }
+
+ public XmlElementAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.elements.size());
+ }
+
+ private XmlElementAnnotation addNestedAnnotation(int index) {
+ XmlElementAnnotation element = this.buildXmlElementAnnotation(index);
+ this.elements.add(element);
+ return element;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.elements.size();
+ XmlElementAnnotation element = this.addNestedAnnotation(index);
+ element.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(XML_ELEMENTS_LIST, index, element);
+ }
+
+ protected XmlElementAnnotation buildXmlElementAnnotation(int index) {
+ return SourceXmlElementAnnotation.createNestedXmlElementAnnotation(this, this.annotatedElement, index, this.daa);
+ }
+
+ public XmlElementAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.elements, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public XmlElementAnnotation removeNestedAnnotation(int index) {
+ return this.elements.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.elements, XML_ELEMENTS_LIST);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java
new file mode 100644
index 0000000..3b43479
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlEnumValue
+ */
+public final class SourceXmlEnumValueAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlEnumValueAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlEnumValueAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java
new file mode 100644
index 0000000..e3113af
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlID
+ */
+public final class SourceXmlIDAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlIDAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlIDAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java
new file mode 100644
index 0000000..d793654
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlIDREF
+ */
+public final class SourceXmlIDREFAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlIDREFAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlIDREFAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java
index e71c9b3..3d18724 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java
@@ -19,6 +19,7 @@
import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
@@ -50,14 +51,14 @@
// ********** constructors **********
+ public SourceXmlJavaTypeAdapterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ this(parent, element, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(element, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
/**
* Parent is a JavaResourceNode instead of a JavaResourceAnnotatedElement because
* the parent is sometimes the outer annotation XmlJavaTypeAdaptersAnnotation
*/
- public SourceXmlJavaTypeAdapterAnnotation(JavaResourceNode parent, AnnotatedElement element) {
- this(parent, element, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(element, DECLARATION_ANNOTATION_ADAPTER));
- }
-
public SourceXmlJavaTypeAdapterAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
super(parent, element, daa, annotationAdapter);
this.valueDeclarationAdapter = buildValueAdapter(daa);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdaptersAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdaptersAnnotation.java
index f2aa4b5..bf16f77 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdaptersAnnotation.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdaptersAnnotation.java
@@ -88,9 +88,9 @@
public void syncAddNestedAnnotation(Annotation astAnnotation) {
int index = this.adapters.size();
- XmlJavaTypeAdapterAnnotation namedQuery = this.addNestedAnnotation(index);
- namedQuery.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(XML_JAVA_TYPE_ADAPTERS_LIST, index, namedQuery);
+ XmlJavaTypeAdapterAnnotation adapter = this.addNestedAnnotation(index);
+ adapter.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(XML_JAVA_TYPE_ADAPTERS_LIST, index, adapter);
}
protected XmlJavaTypeAdapterAnnotation buildXmlJavaTypeAdapterAnnotation(int index) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java
new file mode 100644
index 0000000..391dce9
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlList
+ */
+public final class SourceXmlListAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlListAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlListAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java
new file mode 100644
index 0000000..ebf87f5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMimeType
+ */
+public final class SourceXmlMimeTypeAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlMimeTypeAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlMimeTypeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java
new file mode 100644
index 0000000..d58ce4f
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlMixed
+ */
+public final class SourceXmlMixedAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlMixedAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlMixedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java
new file mode 100644
index 0000000..c13456c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlValue
+ */
+public final class SourceXmlValueAnnotation
+ extends SourceAnnotation<Attribute>
+ implements XmlValueAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceXmlValueAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //no-op
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ //no-op
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java
new file mode 100644
index 0000000..39e0f87
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlAnyAttribute
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlAnyAttributeAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ANY_ATTRIBUTE;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java
new file mode 100644
index 0000000..7160cda
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlAttachmentRef
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlAttachmentRefAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ATTACHMENT_REF;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java
new file mode 100644
index 0000000..7cdba6a
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlElement
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlElementAnnotation
+ extends NestableAnnotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ELEMENT;
+
+ /**
+ * Corresponds to the 'name' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'namespace' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getNamespace();
+ String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'namespace' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Return the {@link TextRange} for the 'namespace' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getNamespaceTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'defaultValue' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getDefaultValue();
+ String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'defaultValue' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setDefaultValue(String defaultValue);
+
+ /**
+ * Return the {@link TextRange} for the 'defaultValue' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getDefaultValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'nillable' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getNillable();
+ String NILLABLE_PROPERTY = "nillable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'nillable' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setNillable(Boolean nillable);
+
+ /**
+ * Return the {@link TextRange} for the 'nillable' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getNillableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'required' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getRequired();
+ String REQUIRED_PROPERTY = "required"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'required' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setRequired(Boolean required);
+
+ /**
+ * Return the {@link TextRange} for the 'required' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getRequiredTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'type' element of the XmlElement annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * @XmlElement(type=Foo.class)
+ * </pre>
+ * will return "Foo"
+ */
+ String getType();
+ String TYPE_PROPERTY = "type"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'type' element of the XmlElement annotation.
+ * Set to null to remove the element.
+ */
+ void setType(String type);
+ /**
+ * Return the {@link TextRange} for the 'type' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElement annotation.
+ */
+ TextRange getTypeTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified type name as resolved by the AST's bindings.
+ * <pre>
+ * @XmlElement(type=Foo.class)
+ * </pre>
+ * will return "model.Foo" if there is an import for model.Foo.
+ * @return
+ */
+ String getFullyQualifiedTypeName();
+ String FULLY_QUALIFIED_TYPE_NAME_PROPERTY = "fullyQualifiedTypeName"; //$NON-NLS-1$
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java
new file mode 100644
index 0000000..b195d22
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlElementRef
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlElementRefAnnotation
+ extends NestableAnnotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ELEMENT_REF;
+
+ /**
+ * Corresponds to the 'name' element of the XmlElementRef annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the XmlElementRef annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElementRef annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'namespace' element of the XmlElementRef annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getNamespace();
+ String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'namespace' element of the XmlElementRef annotation.
+ * Set to null to remove the element.
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Return the {@link TextRange} for the 'namespace' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElementRef annotation.
+ */
+ TextRange getNamespaceTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'type' element of the XmlElementRef annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * @XmlElementRef(type=Foo.class)
+ * </pre>
+ * will return "Foo"
+ */
+ String getType();
+ String TYPE_PROPERTY = "type"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'type' element of the XmlElementRef annotation.
+ * Set to null to remove the element.
+ */
+ void setType(String type);
+ /**
+ * Return the {@link TextRange} for the 'type' element. If the element
+ * does not exist return the {@link TextRange} for the XmlElementRef annotation.
+ */
+ TextRange getTypeTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified type name as resolved by the AST's bindings.
+ * <pre>
+ * @XmlElementRef(type=Foo.class)
+ * </pre>
+ * will return "model.Foo" if there is an import for model.Foo.
+ * @return
+ */
+ String getFullyQualifiedTypeName();
+ String FULLY_QUALIFIED_TYPE_NAME_PROPERTY = "fullyQualifiedTypeName"; //$NON-NLS-1$
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefsAnnotation.java
new file mode 100644
index 0000000..4fe3c5c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefsAnnotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlElementRefs
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlElementRefsAnnotation
+ extends ContainerAnnotation<XmlElementRefAnnotation> {
+
+ String ANNOTATION_NAME = JAXB.XML_ELEMENT_REFS;
+
+ String XML_ELEMENT_REFS_LIST = "xmlElementRefs"; //$NON-NLS-1$
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java
new file mode 100644
index 0000000..3ee71c3
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlElements
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlElementsAnnotation
+ extends ContainerAnnotation<XmlElementAnnotation> {
+
+ String ANNOTATION_NAME = JAXB.XML_ELEMENTS;
+
+ String XML_ELEMENTS_LIST = "xmlElements"; //$NON-NLS-1$
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java
new file mode 100644
index 0000000..10b8ef4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlEnumValue
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlEnumValueAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ENUM_VALUE;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java
new file mode 100644
index 0000000..dd59a82
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlID
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlIDAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_ID;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java
new file mode 100644
index 0000000..911c2e7
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlIDREF
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlIDREFAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_IDREF;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java
new file mode 100644
index 0000000..82c5fe8
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlList
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlListAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_LIST;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java
new file mode 100644
index 0000000..69e02db
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlMimeType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlMimeTypeAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_MIME_TYPE;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java
new file mode 100644
index 0000000..e2e3255
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlMixed
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlMixedAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_MIXED;
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java
new file mode 100644
index 0000000..82d6a30
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JAXB annotation
+ * javax.xml.bind.annotation.XmlValue
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface XmlValueAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JAXB.XML_VALUE;
+
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java
index 6efa59a..13d3ef5 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java
@@ -18,14 +18,25 @@
TestSuite suite = new TestSuite(JaxbJavaResourceModelTests.class.getName());
suite.addTestSuite(XmlAccessorOrderAnnotationTests.class);
suite.addTestSuite(XmlAccessorTypeAnnotationTests.class);
+ suite.addTestSuite(XmlAnyAttributeAnnotationTests.class);
+ suite.addTestSuite(XmlAttachmentRefAnnotationTests.class);
+ suite.addTestSuite(XmlElementAnnotationTests.class);
+ suite.addTestSuite(XmlElementRefAnnotationTests.class);
suite.addTestSuite(XmlEnumAnnotationTests.class);
+ suite.addTestSuite(XmlEnumValueAnnotationTests.class);
+ suite.addTestSuite(XmlIDAnnotationTests.class);
+ suite.addTestSuite(XmlIDREFAnnotationTests.class);
suite.addTestSuite(XmlInlineBinaryDataAnnotationTests.class);
suite.addTestSuite(XmlJavaTypeAdapterAnnotationTests.class);
+ suite.addTestSuite(XmlListAnnotationTests.class);
+ suite.addTestSuite(XmlMimeTypeAnnotationTests.class);
+ suite.addTestSuite(XmlMixedAnnotationTests.class);
suite.addTestSuite(XmlRegistryAnnotationTests.class);
suite.addTestSuite(XmlRootElementAnnotationTests.class);
suite.addTestSuite(XmlSeeAlsoAnnotationTests.class);
suite.addTestSuite(XmlTransientAnnotationTests.class);
suite.addTestSuite(XmlTypeAnnotationTests.class);
+ suite.addTestSuite(XmlValueAnnotationTests.class);
return suite;
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java
new file mode 100644
index 0000000..6bd1c4e
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlAnyAttributeAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlAnyAttributeAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlAnyAttribute() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ANY_ATTRIBUTE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlAnyAttribute");
+ }
+ });
+ }
+
+ public void testGetXmlAnyAttribute() throws Exception {
+ ICompilationUnit cu = this.createTestXmlAnyAttribute();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlAnyAttributeAnnotation xmlAnyAttributeAnnotation = (XmlAnyAttributeAnnotation) attributeResource.getAnnotation(JAXB.XML_ANY_ATTRIBUTE);
+ assertTrue(xmlAnyAttributeAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_ANY_ATTRIBUTE);
+ assertSourceDoesNotContain("@XmlAnyAttribute", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java
new file mode 100644
index 0000000..9dc7870
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlAttachmentRefAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlAttachmentRefAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlAttachmentRef() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ATTACHMENT_REF);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlAttachmentRef");
+ }
+ });
+ }
+
+ public void testGetXmlAttachmentRef() throws Exception {
+ ICompilationUnit cu = this.createTestXmlAttachmentRef();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ATTACHMENT_REF);
+ assertTrue(xmlAttachmentRefAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_ATTACHMENT_REF);
+ assertSourceDoesNotContain("@XmlAttachmentRef", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java
new file mode 100644
index 0000000..2167385
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlElementAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ private static final String XML_ELEMENT_NAME = "elementName";
+ private static final String XML_ELEMENT_NAMESPACE = "XmlElementNamespace";
+ private static final String XML_ELEMENT_DEFAULT_VALUE = "myDefaultValue";
+ private static final String XML_ELEMENT_TYPE = "String";
+
+ public XmlElementAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlElement() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElement");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestXmlElementWithName() throws Exception {
+ return this.createTestXmlElementWithStringElement("name", XML_ELEMENT_NAME);
+ }
+
+ private ICompilationUnit createTestXmlElementWithNamespace() throws Exception {
+ return this.createTestXmlElementWithStringElement("namespace", XML_ELEMENT_NAMESPACE);
+ }
+
+ private ICompilationUnit createTestXmlElementWithDefaultValue() throws Exception {
+ return this.createTestXmlElementWithStringElement("defaultValue", XML_ELEMENT_DEFAULT_VALUE);
+ }
+
+ private ICompilationUnit createTestXmlElementWithStringElement(final String element, final String value) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElement(" + element + " = \"" + value + "\")");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestXmlElementWithBooleanElement(final String booleanElement) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElement(" + booleanElement + " = true)");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestXmlElementWithType() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class)");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertNull(xmlElementAnnotation.getName());
+ assertNull(xmlElementAnnotation.getNamespace());
+ assertNull(xmlElementAnnotation.getDefaultValue());
+ assertNull(xmlElementAnnotation.getNillable());
+ assertNull(xmlElementAnnotation.getRequired());
+ assertNull(xmlElementAnnotation.getType());
+ }
+
+ public void testSetName() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertNull(xmlElementAnnotation.getName());
+ xmlElementAnnotation.setName(XML_ELEMENT_NAME);
+ assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
+
+ assertSourceContains("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
+ }
+
+ public void testSetNameNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
+
+ xmlElementAnnotation.setName(null);
+ assertNull(xmlElementAnnotation.getName());
+
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
+ }
+
+ public void testGetNamespace() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithNamespace();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
+ }
+
+ public void testSetNamespace() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertNull(xmlElementAnnotation.getNamespace());
+ xmlElementAnnotation.setNamespace(XML_ELEMENT_NAMESPACE);
+ assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
+
+ assertSourceContains("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
+ }
+
+ public void testSetNamespaceNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithNamespace();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
+
+ xmlElementAnnotation.setNamespace(null);
+ assertNull(xmlElementAnnotation.getNamespace());
+
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
+ }
+
+ public void testGetDefaultValue() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithDefaultValue();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
+ }
+
+ public void testSetDefaultValue() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertNull(xmlElementAnnotation.getDefaultValue());
+ xmlElementAnnotation.setDefaultValue(XML_ELEMENT_DEFAULT_VALUE);
+ assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
+
+ assertSourceContains("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
+ }
+
+ public void testSetDefaultValueNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithDefaultValue();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
+
+ xmlElementAnnotation.setDefaultValue(null);
+ assertNull(xmlElementAnnotation.getDefaultValue());
+
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
+ }
+
+ public void testGetNillable() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("nillable");
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+
+ assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable());
+ }
+
+ public void testSetNillable() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+
+ assertNotNull(xmlElementAnnotation);
+ assertNull(xmlElementAnnotation.getNillable());
+
+ xmlElementAnnotation.setNillable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlElementAnnotation.getNillable());
+
+ assertSourceContains("@XmlElement(nillable = false)", cu);
+
+ xmlElementAnnotation.setNillable(null);
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("nillable", cu);
+ }
+
+ public void testGetRequired() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("required");
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+
+ assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired());
+ }
+
+ public void testSetRequired() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+
+ assertNotNull(xmlElementAnnotation);
+ assertNull(xmlElementAnnotation.getRequired());
+
+ xmlElementAnnotation.setRequired(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlElementAnnotation.getRequired());
+
+ assertSourceContains("@XmlElement(required = false)", cu);
+
+ xmlElementAnnotation.setRequired(null);
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("required", cu);
+ }
+
+ public void testGetType() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithType();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
+ assertEquals("java.lang." + XML_ELEMENT_TYPE, xmlElementAnnotation.getFullyQualifiedTypeName());
+ }
+
+ public void testSetType() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElement();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertNull(xmlElementAnnotation.getType());
+ xmlElementAnnotation.setType(XML_ELEMENT_TYPE);
+ assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
+
+ assertSourceContains("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
+ }
+
+ public void testSetTypeNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithType();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
+
+ xmlElementAnnotation.setType(null);
+ assertNull(xmlElementAnnotation.getType());
+
+ assertSourceContains("@XmlElement", cu);
+ assertSourceDoesNotContain("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
+ }
+
+ public void testAddXmlElementAnnotation() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT);
+ assertTrue(xmlElementAnnotation != null);
+ assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
+
+ XmlElementAnnotation xmlElementAnnotation2 = (XmlElementAnnotation) attributeResource.addAnnotation(1, JAXB.XML_ELEMENT, JAXB.XML_ELEMENTS);
+ xmlElementAnnotation2.setName("Foo");
+ assertSourceContains("@XmlElements({@XmlElement(name = \"" + XML_ELEMENT_NAME + "\"),@XmlElement(name = \"Foo\")})", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java
new file mode 100644
index 0000000..1acaa3b
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlElementRefAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ private static final String XML_ELEMENT_REF_NAME = "elementName";
+ private static final String XML_ELEMENT_REF_NAMESPACE = "XmlElementRefNamespace";
+ private static final String XML_ELEMENT_REF_TYPE = "String";
+
+ public XmlElementRefAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlElementRef() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElementRef");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestXmlElementRefWithName() throws Exception {
+ return this.createTestXmlElementRefWithStringElement("name", XML_ELEMENT_REF_NAME);
+ }
+
+ private ICompilationUnit createTestXmlElementRefWithNamespace() throws Exception {
+ return this.createTestXmlElementRefWithStringElement("namespace", XML_ELEMENT_REF_NAMESPACE);
+ }
+
+ private ICompilationUnit createTestXmlElementRefWithStringElement(final String element, final String value) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElementRef(" + element + " = \"" + value + "\")");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestXmlElementRefWithType() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class)");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertTrue(xmlElementRefAnnotation != null);
+ assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRef();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertTrue(xmlElementRefAnnotation != null);
+ assertNull(xmlElementRefAnnotation.getName());
+ assertNull(xmlElementRefAnnotation.getNamespace());
+ assertNull(xmlElementRefAnnotation.getType());
+ }
+
+ public void testSetName() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRef();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertNull(xmlElementRefAnnotation.getName());
+ xmlElementRefAnnotation.setName(XML_ELEMENT_REF_NAME);
+ assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
+
+ assertSourceContains("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu);
+ }
+
+ public void testSetNameNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
+
+ xmlElementRefAnnotation.setName(null);
+ assertNull(xmlElementRefAnnotation.getName());
+
+ assertSourceContains("@XmlElementRef", cu);
+ assertSourceDoesNotContain("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu);
+ }
+
+ public void testGetNamespace() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithNamespace();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertTrue(xmlElementRefAnnotation != null);
+ assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
+ }
+
+ public void testSetNamespace() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRef();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertNull(xmlElementRefAnnotation.getNamespace());
+ xmlElementRefAnnotation.setNamespace(XML_ELEMENT_REF_NAMESPACE);
+ assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
+
+ assertSourceContains("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu);
+ }
+
+ public void testSetNamespaceNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithNamespace();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
+
+ xmlElementRefAnnotation.setNamespace(null);
+ assertNull(xmlElementRefAnnotation.getNamespace());
+
+ assertSourceContains("@XmlElementRef", cu);
+ assertSourceDoesNotContain("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu);
+ }
+
+ public void testGetType() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithType();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertTrue(xmlElementRefAnnotation != null);
+ assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
+ assertEquals("java.lang." + XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getFullyQualifiedTypeName());
+ }
+
+ public void testSetType() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRef();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertNull(xmlElementRefAnnotation.getType());
+ xmlElementRefAnnotation.setType(XML_ELEMENT_REF_TYPE);
+ assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
+
+ assertSourceContains("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu);
+ }
+
+ public void testSetTypeNull() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithType();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
+
+ xmlElementRefAnnotation.setType(null);
+ assertNull(xmlElementRefAnnotation.getType());
+
+ assertSourceContains("@XmlElementRef", cu);
+ assertSourceDoesNotContain("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu);
+ }
+
+ public void testAddXmlElementRefAnnotation() throws Exception {
+ ICompilationUnit cu = this.createTestXmlElementRefWithName();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) attributeResource.getAnnotation(JAXB.XML_ELEMENT_REF);
+ assertTrue(xmlElementRefAnnotation != null);
+ assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
+
+ XmlElementRefAnnotation xmlElementRefAnnotation2 = (XmlElementRefAnnotation) attributeResource.addAnnotation(1, JAXB.XML_ELEMENT_REF, JAXB.XML_ELEMENT_REFS);
+ xmlElementRefAnnotation2.setName("Foo");
+ assertSourceContains("@XmlElementRefs({@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\"),@XmlElementRef(name = \"Foo\")})", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java
new file mode 100644
index 0000000..a1d5a0d
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlEnumValueAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlEnumValueAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlEnumValue() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ENUM_VALUE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlEnumValue");
+ }
+ });
+ }
+
+ public void testGetXmlEnumValue() throws Exception {
+ ICompilationUnit cu = this.createTestXmlEnumValue();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) attributeResource.getAnnotation(JAXB.XML_ENUM_VALUE);
+ assertTrue(xmlEnumValueAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_ENUM_VALUE);
+ assertSourceDoesNotContain("@XmlEnumValue", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java
new file mode 100644
index 0000000..c9186f4
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlIDAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlIDAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlID() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_ID);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlID");
+ }
+ });
+ }
+
+ public void testGetXmlID() throws Exception {
+ ICompilationUnit cu = this.createTestXmlID();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) attributeResource.getAnnotation(JAXB.XML_ID);
+ assertTrue(xmlIDAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_ID);
+ assertSourceDoesNotContain("@XmlID", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java
new file mode 100644
index 0000000..8b1961f
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlIDREFAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlIDREFAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlIDREF() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_IDREF);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlIDREF");
+ }
+ });
+ }
+
+ public void testGetXmlIDREF() throws Exception {
+ ICompilationUnit cu = this.createTestXmlIDREF();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) attributeResource.getAnnotation(JAXB.XML_IDREF);
+ assertTrue(xmlIDREFAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_IDREF);
+ assertSourceDoesNotContain("@XmlIDREF", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java
new file mode 100644
index 0000000..f25b5f3
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlListAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlListAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlList() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_LIST);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlList");
+ }
+ });
+ }
+
+ public void testGetXmlList() throws Exception {
+ ICompilationUnit cu = this.createTestXmlList();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) attributeResource.getAnnotation(JAXB.XML_LIST);
+ assertTrue(xmlListAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_LIST);
+ assertSourceDoesNotContain("@XmlList", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java
new file mode 100644
index 0000000..f98e736
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlMimeTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlMimeTypeAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlMimeType() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_MIME_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlMimeType");
+ }
+ });
+ }
+
+ public void testGetXmlMimeType() throws Exception {
+ ICompilationUnit cu = this.createTestXmlMimeType();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) attributeResource.getAnnotation(JAXB.XML_MIME_TYPE);
+ assertTrue(xmlMimeTypeAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_MIME_TYPE);
+ assertSourceDoesNotContain("@XmlMimeType", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java
new file mode 100644
index 0000000..c476c0e
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlMixedAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlMixedAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlMixed() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_MIXED);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlMixed");
+ }
+ });
+ }
+
+ public void testGetXmlMixed() throws Exception {
+ ICompilationUnit cu = this.createTestXmlMixed();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlMixedAnnotation xmlMixedAnnotation = (XmlMixedAnnotation) attributeResource.getAnnotation(JAXB.XML_MIXED);
+ assertTrue(xmlMixedAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_MIXED);
+ assertSourceDoesNotContain("@XmlMixed", cu);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java
new file mode 100644
index 0000000..1ba7e77
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+@SuppressWarnings("nls")
+public class XmlValueAnnotationTests extends JaxbJavaResourceModelTestCase {
+
+ public XmlValueAnnotationTests(String name) {
+ super(name);
+ }
+
+ private ICompilationUnit createTestXmlValue() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_VALUE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlValue");
+ }
+ });
+ }
+
+ public void testGetXmlValue() throws Exception {
+ ICompilationUnit cu = this.createTestXmlValue();
+ JavaResourcePersistentType typeResource = buildJavaTypeResource(cu);
+ JavaResourcePersistentAttribute attributeResource = typeResource.fields().next();
+
+ XmlValueAnnotation xmlValueAnnotation = (XmlValueAnnotation) attributeResource.getAnnotation(JAXB.XML_VALUE);
+ assertTrue(xmlValueAnnotation != null);
+
+ attributeResource.removeAnnotation(JAXB.XML_VALUE);
+ assertSourceDoesNotContain("@XmlValue", cu);
+ }
+}