326717 - JAXB support for XmlAttribute, XmlELement, XmlJavaTypeAdapter and the corresponding validation
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties
index 87ef3be..ec96510 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties
@@ -1,5 +1,5 @@
 ################################################################################
-# Copyright (c) 2010 Oracle. All rights reserved.
+# Copyright (c) 2010, 2011 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.
@@ -11,9 +11,12 @@
 NO_JAXB_PROJECT = This project has the JAXB facet, but no JAXB content could be created.  See the error log for more details.
 
 PACKAGE_NO_SCHEMA_FOR_NAMESPACE = There is no schema specified on the project for the namespace ''{0}'' on the package ''{1}''.  No schema-specific validation will be performed.
+PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED = The type must be specified for an XML Java type adapter on a package
 
 XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE = The namespace for an anonymous type should not be different from its package.
 XML_TYPE_UNRESOLVED_SCHEMA_TYPE = The type definition with name ''{0}'' and namespace ''{1}'' cannot be resolved
 
 XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT = The element declaration with name ''{0}'' and namespace ''{1}'' cannot be resolved
-XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE = The xml type of the element declaration with name ''{0}'' and namespace ''{1}'' conflicts with the xml type of the associated class
\ No newline at end of file
+XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE = The xml type of the element declaration with name ''{0}'' and namespace ''{1}'' conflicts with the xml type of the associated class
+
+ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED = The type for XML Java type adapter is not defined
\ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java
index 625c371..2017f3e 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java
@@ -31,7 +31,6 @@
 import org.eclipse.jpt.jaxb.core.context.JaxbRegistry;
 import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
 import org.eclipse.jpt.jaxb.core.context.XmlElementMapping;
-import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
 import org.eclipse.jpt.jaxb.core.context.XmlNs;
 import org.eclipse.jpt.jaxb.core.context.XmlRootElement;
 import org.eclipse.jpt.jaxb.core.context.XmlSchema;
@@ -42,7 +41,6 @@
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
@@ -122,8 +120,6 @@
 	
 	XmlSchemaType buildJavaXmlSchemaType(JaxbContextNode parent, XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation);
 	
-	XmlJavaTypeAdapter buildJavaXmlJavaTypeAdapter(JaxbContextNode parent, XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation);
-	
 	XmlNs buildJavaXmlNs(XmlSchema parent, XmlNsAnnotation xmlNsAnnotation);
 
 	XmlRootElement buildJavaXmlRootElement(JaxbPersistentType parent, XmlRootElementAnnotation xmlRootElementAnnotation);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
index 575a957..62c10ee 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
@@ -9,6 +9,9 @@
  *******************************************************************************/
 package org.eclipse.jpt.jaxb.core.context;
 
+import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
+
 
 /**
  * Represents a JAXB attribute mapping.
@@ -23,10 +26,12 @@
  * @since 3.0
  */
 public interface JaxbAttributeMapping
-		extends JaxbContextNode {
+		extends JavaContextNode {
 
 	JaxbPersistentAttribute getParent();
 
+	JavaResourceAttribute getJavaResourceAttribute();
+
 	String getKey();
 
 	/**
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java
index 55d43b2..f6a265a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java
@@ -9,9 +9,12 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.context;
 
+import java.util.List;
 import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
 import org.eclipse.jpt.utility.internal.iterables.ListIterable;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 /**
  * 
@@ -60,4 +63,12 @@
 	void moveXmlJavaTypeAdapter(int targetIndex, int sourceIndex);
 		String XML_JAVA_TYPE_ADAPTERS_LIST = "xmlJavaTypeAdapters"; //$NON-NLS-1$
 
+
+	// **************** validation ********************************************
+	
+	/**
+	 * Add validation messages to the specified list.
+	 */
+	void validate(List<IMessage> messages, IReporter reporter);
+
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java
index b5c6d72..10f5f3f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java
@@ -9,6 +9,7 @@
  *******************************************************************************/
 package org.eclipse.jpt.jaxb.core.context;
 
+import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod;
@@ -26,7 +27,7 @@
  * @since 3.0
  */
 public interface JaxbPersistentAttribute
-		extends JaxbContextNode {
+		extends JavaContextNode {
 
 
 	// ********** name **********
@@ -43,6 +44,11 @@
 
 	JavaResourceAttribute getJavaResourceAttribute();
 
+	/**
+	 * Return the type name of the java resource attribute
+	 * This might not return the same thing as getJavaResourceAttribute().getTypeName().
+	 */
+	String getJavaResourceAttributeTypeName();
 
 	// ********** mapping **********
 
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java
index b3989ea..92c790f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- *  Copyright (c) 2010  Oracle. All rights reserved.
+ *  Copyright (c) 2010, 2011  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
@@ -25,7 +25,7 @@
  * @since 3.0
  */
 public interface JaxbPersistentClass
-		extends JaxbPersistentType, XmlAccessTypeHolder, XmlAccessOrderHolder {
+		extends JaxbPersistentType, XmlAccessTypeHolder, XmlAccessOrderHolder, XmlAdaptable {
 
 	/**
 	 * covariant override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java
new file mode 100644
index 0000000..d0d03b9
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ *  Copyright (c) 2011  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.context;
+
+import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+
+public interface XmlAdaptable
+	extends JavaContextNode
+{
+	/********** XmlJavaTypeAdapter **********/
+	XmlJavaTypeAdapter getXmlJavaTypeAdapter();
+	XmlJavaTypeAdapter addXmlJavaTypeAdapter();
+	void removeXmlJavaTypeAdapter();
+		String XML_JAVA_TYPE_ADAPTER_PROPERTY = "xmlJavaTypeAdapter"; //$NON-NLS-1$
+
+	interface Owner {
+		JavaResourceAnnotatedElement getResource();
+		XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation);
+		void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter);
+	}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java
index 0d7fb7e..0890e0f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java
@@ -23,7 +23,7 @@
  * @since 3.0
  */
 public interface XmlAttributeMapping
-		extends JaxbAttributeMapping {
+		extends JaxbAttributeMapping, XmlAdaptable {
 
 
 	String getName();
@@ -44,4 +44,29 @@
 	String getSpecifiedNamespace();
 	void setSpecifiedNamespace(String namespace);
 		String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$
+
+
+//	// ********** xml schema type ************
+//	/**
+//	 * Return whether this class has an XmlSchemaType annotation)
+//	 */
+//	boolean hasXmlSchemaType();
+//
+//	/**
+//	 * Return the xml schema type or null.
+//	 */
+//	XmlSchemaType getXmlSchemaType();
+//
+//	/**
+//	 * Set the xml schema type name, this will add the XmlSchemaType annotation
+//	 * and set its name to the specified name.
+//	 * To remove the XmlSchemaType annotation, pass in null.
+//	 * To set the name when the class already has an XmlSchemaType,
+//	 * set it directly on the XmlSchemaType.
+//	 */
+//		
+//	XmlSchemaType setXmlSchemaTypeName(String name);
+//		String XML_SCHEMA_TYPE = "xmlSchemaType"; //$NON-NLS-1$
+//	
+	
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java
index d28f940..e5d83bf 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java
@@ -23,7 +23,7 @@
  * @since 3.0
  */
 public interface XmlElementMapping
-		extends JaxbAttributeMapping {
+		extends JaxbAttributeMapping, XmlAdaptable {
 
 
 	String getName();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java
index cfbe0b7..76d3d69 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -9,6 +9,7 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.context;
 
+import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 
 /**
@@ -25,7 +26,7 @@
  */
 public interface XmlJavaTypeAdapter
 	extends 
-		JaxbContextNode
+		JavaContextNode
 {
 
 	XmlJavaTypeAdapterAnnotation getResourceXmlJavaTypeAdapter();
@@ -40,7 +41,11 @@
 	/**************** type *****************/
 
 	String getType();
-	void setType(String type);
-		String TYPE_PROPERTY = "type"; //$NON-NLS-1$
+	String getDefaultType();
+		String DEFAULT_TYPE_PROPERTY = "defaultType"; //$NON-NLS-1$
+	String getSpecifiedType();
+	void setSpecifiedType(String type);
+		String SPECIFIED_TYPE_PROPERTY = "specifiedType"; //$NON-NLS-1$
 		String DEFAULT_TYPE = "javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT"; //$NON-NLS-1$
+
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java
index e1760b6..f66ae2a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java
@@ -32,7 +32,6 @@
 import org.eclipse.jpt.jaxb.core.context.JaxbRegistry;
 import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
 import org.eclipse.jpt.jaxb.core.context.XmlElementMapping;
-import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
 import org.eclipse.jpt.jaxb.core.context.XmlNs;
 import org.eclipse.jpt.jaxb.core.context.XmlRootElement;
 import org.eclipse.jpt.jaxb.core.context.XmlSchema;
@@ -50,7 +49,6 @@
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaRegistry;
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlAttributeMapping;
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlElementMapping;
-import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlJavaTypeAdapter;
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlNs;
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlRootElement;
 import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlSchema;
@@ -62,7 +60,6 @@
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
@@ -127,10 +124,6 @@
 		return new GenericJavaXmlSchemaType(parent, resourceXmlSchemaType);
 	}
 	
-	public XmlJavaTypeAdapter buildJavaXmlJavaTypeAdapter(JaxbContextNode parent, XmlJavaTypeAdapterAnnotation resourceXmlJavaTypeAdapter) {
-		return new GenericJavaXmlJavaTypeAdapter(parent, resourceXmlJavaTypeAdapter);
-	}
-	
 	public JaxbEnumConstant buildJavaEnumConstant(JaxbPersistentEnum parent, JavaResourceEnumConstant resourceEnumConstant) {
 		return new GenericJavaEnumConstant(parent, resourceEnumConstant);
 	}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java
index 1ac1d13..7fa947f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -18,6 +18,7 @@
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
 import org.eclipse.jpt.jaxb.core.xsd.XsdSchema;
 import org.eclipse.jpt.jaxb.core.xsd.XsdUtil;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
 import org.eclipse.wst.validation.internal.provisional.core.IMessage;
 import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 import org.eclipse.xsd.XSDSchema;
@@ -117,5 +118,9 @@
 						new String[] {getNamespace(), this.name},
 						this));
 		}
+		if (reporter.isCancelled()) {
+			throw new ValidationCancelledException();
+		}
+		this.getPackageInfo().validate(messages, reporter);
 	}
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java
index 3f58a9e..d53e117 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java
@@ -9,14 +9,15 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.internal.context.java;
 
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.utility.TextRange;
 import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
-import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode;
 import org.eclipse.jpt.jaxb.core.resource.java.Annotation;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
 
 public abstract class AbstractJavaAttributeMapping<A extends Annotation>
-	extends AbstractJaxbContextNode
+	extends AbstractJavaContextNode
 	implements JaxbAttributeMapping
 {
 
@@ -88,6 +89,14 @@
 	}
 
 
+	// ********** validation **********
+
+	@Override
+	public TextRange getValidationTextRange(CompilationUnit astRoot) {
+		return getAnnotation_() == null ? getJavaResourceAttribute().getNameTextRange(astRoot) : getAnnotation_().getTextRange(astRoot);
+	}
+
+
 	// ********** misc **********
 
 	@Override
@@ -103,4 +112,7 @@
 		return this.getPersistentAttribute().getJavaResourceAttribute();
 	}
 
+	public String getJavaResourceAttributeType() {
+		return this.getPersistentAttribute().getJavaResourceAttributeTypeName();
+	}
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java
new file mode 100644
index 0000000..e43ff59
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+
+public abstract class AbstractJavaXmlJavaTypeAdapter
+	extends AbstractJavaContextNode
+	implements XmlJavaTypeAdapter
+{
+
+	protected final XmlJavaTypeAdapterAnnotation resourceXmlJavaTypeAdapter;
+
+	protected String value;
+
+	protected String specifiedType;
+
+	protected String defaultType;
+
+	public AbstractJavaXmlJavaTypeAdapter(JaxbContextNode parent, XmlJavaTypeAdapterAnnotation resource) {
+		super(parent);
+		this.resourceXmlJavaTypeAdapter = resource;
+		this.value = this.getResourceValue();
+		this.specifiedType = this.getResourceTypeString();
+		this.defaultType = this.buildDefaultType();
+	}
+
+
+	// ********** synchronize/update **********
+
+	public void synchronizeWithResourceModel() {
+		this.setValue_(this.getResourceValue());
+		this.setSpecifiedType_(this.getResourceTypeString());
+		this.setDefaultType(this.buildDefaultType());
+	}
+
+	public void update() {
+		//nothing yet
+	}
+
+
+	// ********** xml java type adapter annotation **********
+
+	public XmlJavaTypeAdapterAnnotation getResourceXmlJavaTypeAdapter() {
+		return this.resourceXmlJavaTypeAdapter;
+	}
+
+	// ********** value **********
+
+	public String getValue() {
+		return this.value;
+	}
+
+	public void setValue(String value) {
+		this.resourceXmlJavaTypeAdapter.setValue(value);
+		this.setValue_(value);	
+	}
+
+	protected void setValue_(String value) {
+		String old = this.value;
+		this.value = value;
+		this.firePropertyChanged(VALUE_PROPERTY, old, value);
+	}
+
+	protected String getResourceValue() {
+		return this.resourceXmlJavaTypeAdapter.getValue();
+	}
+
+
+	// ********** type **********
+
+	public String getType() {
+		return this.specifiedTypeNotSet() ? this.getDefaultType() : this.getSpecifiedType();
+	}
+
+	/**
+	 * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT
+	 */
+	protected boolean specifiedTypeNotSet() {
+		return getSpecifiedType() == null || getSpecifiedType().equals(DEFAULT_TYPE);
+	}
+
+	public String getDefaultType() {
+		return this.defaultType;
+	}
+
+	protected void setDefaultType(String defaultType) {
+		String oldDefaultType = this.defaultType;
+		this.defaultType = defaultType;
+		firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, defaultType);
+	}
+
+	protected abstract String buildDefaultType();
+
+	public String getSpecifiedType() {
+		return this.specifiedType;
+	}
+
+	public void setSpecifiedType(String location) {
+		this.resourceXmlJavaTypeAdapter.setType(location);
+		this.setSpecifiedType_(location);	
+	}
+
+	protected void setSpecifiedType_(String type) {
+		String old = this.specifiedType;
+		this.specifiedType = type;
+		this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type);
+	}
+
+	protected String getResourceTypeString() {
+		return this.resourceXmlJavaTypeAdapter.getType();
+	}
+
+
+	// ********** validation **********
+
+	@Override
+	public TextRange getValidationTextRange(CompilationUnit astRoot) {
+		return getResourceXmlJavaTypeAdapter().getTextRange(astRoot);
+	}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java
new file mode 100644
index 0000000..df7840c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping;
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages;
+import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaAttributeXmlJavaTypeAdapter
+	extends AbstractJavaXmlJavaTypeAdapter
+{
+
+	public GenericJavaAttributeXmlJavaTypeAdapter(JaxbAttributeMapping parent, XmlJavaTypeAdapterAnnotation resource) {
+		super(parent, resource);
+	}
+
+	@Override
+	public JaxbAttributeMapping getParent() {
+		return (JaxbAttributeMapping) super.getParent();
+	}
+
+	protected JaxbPersistentAttribute getPersistentAttribute() {
+		return getParent().getParent();
+	}
+
+	// ********** type **********
+
+	@Override
+	protected String buildDefaultType() {
+		return this.getPersistentAttribute().getJavaResourceAttributeTypeName();
+	}
+
+
+	// ********** validation **********
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		if (getType() == null || getType().equals(XmlJavaTypeAdapter.DEFAULT_TYPE)) {
+			messages.add(
+				DefaultValidationMessages.buildMessage(
+					IMessage.HIGH_SEVERITY,
+					JaxbValidationMessages.ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED,
+					this,
+					getResourceXmlJavaTypeAdapter().getTypeTextRange(astRoot)));
+		}
+	}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java
index 81df5c4..5d62edf 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java
@@ -9,6 +9,9 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.internal.context.java;
 
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jpt.core.utility.TextRange;
 import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
@@ -18,14 +21,16 @@
 import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
 import org.eclipse.jpt.jaxb.core.context.XmlSchema;
 import org.eclipse.jpt.jaxb.core.context.XmlSchemaType;
+import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceNode;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
 import org.eclipse.jpt.utility.internal.iterables.ListIterable;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 public class GenericJavaPackageInfo
 		extends AbstractJavaContextNode
@@ -53,6 +58,13 @@
 		this.xmlJavaTypeAdapterContainer = new XmlJavaTypeAdapterContainer();
 	}
 
+	// **************** AbstractJaxbNode impl *********************************
+	
+	@Override
+	public IResource getResource() {
+		return this.resourcePackage.getFile();
+	}
+
 
 	// ********** synchronize/update **********
 
@@ -221,8 +233,8 @@
 		this.xmlJavaTypeAdapterContainer.moveContextElement(targetIndex, sourceIndex);
 	}
 
-	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlSchemaTypeAnnotation) {
-		return this.getFactory().buildJavaXmlJavaTypeAdapter(this, xmlSchemaTypeAnnotation);
+	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
+		return new GenericJavaPackageXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation);
 	}
 
 	protected void syncXmlJavaTypeAdapters() {
@@ -233,16 +245,47 @@
 	protected ListIterable<XmlJavaTypeAdapterAnnotation> getXmlJavaTypeAdapterAnnotations() {
 		return (ListIterable<XmlJavaTypeAdapterAnnotation>) this.resourcePackage.getAnnotations(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
 	}
+
+
+	// **************** misc **************************************************
 	
-	
+	protected CompilationUnit buildASTRoot() {
+		return this.resourcePackage.getJavaResourceCompilationUnit().buildASTRoot();
+	}
+
+
 	// **************** validation ********************************************
 	
+	public void validate(List<IMessage> messages, IReporter reporter) {
+		if (reporter.isCancelled()) {
+			throw new ValidationCancelledException();
+		}
+		IFile file = this.resourcePackage.getFile();
+		// 'file' will be null if the type is "external" and binary;
+		// the file will be in a different project if the type is "external" and source;
+		// the type will be binary if it is in a JAR in the current project
+		if ((file != null) 
+				&& file.getProject().equals(getJaxbProject().getProject()) 
+				&& (this.resourcePackage instanceof SourceNode)) {
+			// build the AST root here to pass down
+			this.validate(messages, reporter, this.buildASTRoot());
+		}
+	}
+
 	@Override
 	public TextRange getValidationTextRange(CompilationUnit astRoot) {
 		return this.resourcePackage.getNameTextRange(astRoot);
 	}
-	
-	
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		for (XmlJavaTypeAdapter adapter : getXmlJavaTypeAdapters()) {
+			adapter.validate(messages, reporter, astRoot);
+		}
+	}
+
+
 	/**
 	 * xml schema type container
 	 */
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java
new file mode 100644
index 0000000..14f9daf
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages;
+import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaPackageXmlJavaTypeAdapter
+	extends AbstractJavaXmlJavaTypeAdapter
+{
+
+	public GenericJavaPackageXmlJavaTypeAdapter(JaxbPackageInfo parent, XmlJavaTypeAdapterAnnotation resource) {
+		super(parent, resource);
+	}
+
+	@Override
+	protected String buildDefaultType() {
+		//there is no default type on a package level XmlJavaTypeAdapter, it must be specified
+		return null;
+	}
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		if (getSpecifiedType() == null || getSpecifiedType().equals(XmlJavaTypeAdapter.DEFAULT_TYPE)) {
+			messages.add(
+				DefaultValidationMessages.buildMessage(
+					IMessage.HIGH_SEVERITY,
+					JaxbValidationMessages.PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED,
+					this,
+					getResourceXmlJavaTypeAdapter().getTypeTextRange(astRoot)));
+		}
+
+	}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java
index 67489b2..3efd156 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java
@@ -9,17 +9,23 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.internal.context.java;
 
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.utility.TextRange;
 import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass;
 import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition;
 import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
 import org.eclipse.jpt.utility.internal.Tools;
 import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 public abstract class GenericJavaPersistentAttribute
-		extends AbstractJaxbContextNode
+		extends AbstractJavaContextNode
 		implements JaxbPersistentAttribute {
 
 	protected JaxbAttributeMapping mapping;  // never null
@@ -310,4 +316,32 @@
 	public void toString(StringBuilder sb) {
 		sb.append(this.getName());
 	}
+
+
+	@Override
+	public TextRange getValidationTextRange(CompilationUnit astRoot) {
+		return this.getJavaResourceAttribute().getTextRange(astRoot);
+	}
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		this.getMapping().validate(messages, reporter, astRoot);
+	}
+
+
+	//**************** static methods *****************
+
+	protected static String getJavaResourceAttributeType(JavaResourceAttribute attribute) {
+		if (attribute.typeIsSubTypeOf(COLLECTION_CLASS_NAME)) {
+			if (attribute.getTypeTypeArgumentNamesSize() == 1) {
+				return attribute.getTypeTypeArgumentName(0);
+			}
+			return null;
+		}
+		return attribute.getTypeName();
+	}
+
+	private static final String COLLECTION_CLASS_NAME = Collection.class.getName();
+
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java
index 18300e3..e12a679 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -13,7 +13,9 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot;
 import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
@@ -22,12 +24,16 @@
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty;
 import org.eclipse.jpt.jaxb.core.context.XmlAccessOrder;
 import org.eclipse.jpt.jaxb.core.context.XmlAccessType;
+import org.eclipse.jpt.jaxb.core.context.XmlAdaptable;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod;
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.utility.Filter;
 import org.eclipse.jpt.utility.internal.CollectionTools;
 import org.eclipse.jpt.utility.internal.StringTools;
@@ -35,6 +41,8 @@
 import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
 import org.eclipse.jpt.utility.internal.iterables.ListIterable;
 import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 public class GenericJavaPersistentClass
 		extends AbstractJavaPersistentType
@@ -50,6 +58,8 @@
 
 	protected final Vector<JaxbPersistentAttribute> attributes = new Vector<JaxbPersistentAttribute>();
 
+	protected final XmlAdaptable xmlAdaptable;
+
 	public GenericJavaPersistentClass(JaxbContextRoot parent, JavaResourceType resourceType) {
 		super(parent, resourceType);
 		this.superPersistentClass = this.buildSuperPersistentClass();
@@ -57,6 +67,7 @@
 		this.specifiedAccessOrder = this.getResourceAccessOrder();
 		this.defaultAccessType = this.buildDefaultAccessType();
 		this.defaultAccessOrder = this.buildDefaultAccessOrder();
+		this.xmlAdaptable = this.buildXmlAdaptable();
 		this.initializeAttributes();
 	}
 
@@ -72,6 +83,7 @@
 		super.synchronizeWithResourceModel();
 		this.setSpecifiedAccessType_(this.getResourceAccessType());
 		this.setSpecifiedAccessOrder_(this.getResourceAccessOrder());
+		this.xmlAdaptable.synchronizeWithResourceModel();
 		this.syncAttributes();
 	}
 
@@ -80,6 +92,7 @@
 		this.setSuperPersistentClass(this.buildSuperPersistentClass());
 		this.setDefaultAccessType(this.buildDefaultAccessType());
 		this.setDefaultAccessOrder(this.buildDefaultAccessOrder());
+		this.xmlAdaptable.update();
 		this.updateAttributes();
 	}
 
@@ -426,7 +439,7 @@
 			return true;
 		}
 		//Lists do not have to have a corresponding setter method
-		else if (getterMethod.getReturnTypeName().equals("java.util.List")) { //$NON-NLS-1$
+		else if (getterMethod.getTypeName().equals("java.util.List")) { //$NON-NLS-1$
 			return true;
 		}
 		else if (getterMethod.isAnnotated()) {
@@ -444,7 +457,7 @@
 				}
 			}
 			//Lists do not have to have a corresponding setter method
-			else if (getterMethod.getReturnTypeName().equals("java.util.List")) { //$NON-NLS-1$
+			else if (getterMethod.getTypeName().equals("java.util.List")) { //$NON-NLS-1$
 				return true;
 			}
 			else if (getterMethod.isAnnotated()) {
@@ -731,7 +744,7 @@
 			return false;
 		}
 
-		String returnTypeName = resourceMethod.getReturnTypeName();
+		String returnTypeName = resourceMethod.getTypeName();
 		if (returnTypeName == null) {
 			return false;  // DOM method bindings can have a null name
 		}
@@ -757,7 +770,7 @@
 	}
 
 	private static boolean methodIsBooleanGetter(JavaResourceMethod resourceMethod) {
-		String returnTypeName = resourceMethod.getReturnTypeName();
+		String returnTypeName = resourceMethod.getTypeName();
 		String name = resourceMethod.getMethodName();
 		boolean booleanGetter = false;
 		if (name.startsWith("is")) { //$NON-NLS-1$
@@ -780,7 +793,7 @@
 	 * from being a getter or setter for a "persistent" property.
 	 */
 	private static boolean methodHasInvalidModifiers(JavaResourceMethod resourceMethod) {
-		int modifiers = resourceMethod.getReturnTypeModifiers();
+		int modifiers = resourceMethod.getModifiers();
 		if (Modifier.isStatic(modifiers)) {
 			return true;
 		}
@@ -815,7 +828,7 @@
 	 */
 	private static JavaResourceMethod getValidSiblingSetMethod(JavaResourceMethod getMethod, Collection<JavaResourceMethod> resourceMethods) {
 		String capitalizedAttributeName = StringTools.capitalize(getMethod.getName());
-		String parameterTypeErasureName = getMethod.getReturnTypeName();
+		String parameterTypeErasureName = getMethod.getTypeName();
 		for (JavaResourceMethod sibling : resourceMethods) {
 			ListIterable<String> siblingParmTypeNames = sibling.getParameterTypeNames();
 			if ((sibling.getParametersSize() == 1)
@@ -841,11 +854,52 @@
 		if (resourceMethod.isConstructor()) {
 			return false;
 		}
-		String rtName = resourceMethod.getReturnTypeName();
+		String rtName = resourceMethod.getTypeName();
 		if (rtName == null) {
 			return false;  // DOM method bindings can have a null name
 		}
 		return rtName.equals(returnTypeName);
 	}
 
+
+	//****************** XmlJavaTypeAdapter *********************
+
+	public XmlAdaptable buildXmlAdaptable() {
+		return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() {
+			public JavaResourceAnnotatedElement getResource() {
+				return getJavaResourceType();
+			}
+			public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) {
+				return GenericJavaPersistentClass.this.buildXmlJavaTypeAdapter(adapterAnnotation);
+			}
+			public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) {
+				GenericJavaPersistentClass.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter);
+			}
+		});
+	}
+
+	public XmlJavaTypeAdapter getXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.getXmlJavaTypeAdapter();
+	}
+
+	public XmlJavaTypeAdapter addXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.addXmlJavaTypeAdapter();
+	}
+
+	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
+		return new GenericJavaTypeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation);
+	}
+
+	public void removeXmlJavaTypeAdapter() {
+		this.xmlAdaptable.removeXmlJavaTypeAdapter();
+	}
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		this.xmlAdaptable.validate(messages, reporter, astRoot);
+		for (JaxbPersistentAttribute attribute : getAttributes()) {
+			attribute.validate(messages, reporter, astRoot);
+		}
+	}
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java
index dabb08e..1103091 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java
@@ -32,6 +32,10 @@
 		return this.getResourceField();
 	}
 
+	public String getJavaResourceAttributeTypeName() {
+		return getJavaResourceAttributeType(this.getJavaResourceAttribute());
+	}
+
 	public JavaResourceField getResourceField() {
 		return this.resourceField;
 	}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java
index 6298673..fcf33f4 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java
@@ -35,6 +35,13 @@
 		return this.calculateResourceMethodToAnnotate();
 	}
 
+	public String getJavaResourceAttributeTypeName() {
+		JavaResourceAttribute getterMethod = getResourceGetterMethod();
+		//it's invalid to have a setter without a getter, so just return null in this case
+		//rather than attempting to define the type from the setter's parameters
+		return getterMethod == null ? null : getJavaResourceAttributeType(getterMethod);
+	}
+
 	public JavaResourceMethod getResourceGetterMethod() {
 		return this.resourceGetter;
 	}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java
index c931547..6fdba9a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- *  Copyright (c) 2010  Oracle. All rights reserved.
+ *  Copyright (c) 2010, 2011 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
@@ -98,7 +98,7 @@
 	}
 
 	protected static boolean methodReturnTypeIsJAXBElement(JavaResourceMethod method) {
-		return method.returnTypeIsSubTypeOf(JAXB_ELEMENT_TYPE_NAME);
+		return method.typeIsSubTypeOf(JAXB_ELEMENT_TYPE_NAME);
 	}
 
 	protected static final String JAXB_ELEMENT_TYPE_NAME = "javax.xml.bind.JAXBElement"; //$NON-NLS-1$
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java
new file mode 100644
index 0000000..4932837
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+
+public class GenericJavaTypeXmlJavaTypeAdapter
+	extends AbstractJavaXmlJavaTypeAdapter
+{
+
+	public GenericJavaTypeXmlJavaTypeAdapter(JaxbPersistentClass parent, XmlJavaTypeAdapterAnnotation resource) {
+		super(parent, resource);
+	}
+
+	@Override
+	public JaxbPersistentClass getParent() {
+		return (JaxbPersistentClass) super.getParent();
+	}
+
+	// ********** type **********
+	@Override
+	protected String buildDefaultType() {
+		return getParent().getJavaResourceType().getQualifiedName();
+	}
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java
new file mode 100644
index 0000000..c3456f6
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.jaxb.core.JaxbNode;
+import org.eclipse.jpt.jaxb.core.context.XmlAdaptable;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+
+class GenericJavaXmlAdaptable
+	extends AbstractJavaContextNode
+	implements XmlAdaptable {
+
+	protected XmlJavaTypeAdapter xmlJavaTypeAdapter;
+
+	protected XmlAdaptable.Owner owner;
+
+	GenericJavaXmlAdaptable(JaxbNode parent, XmlAdaptable.Owner owner) {
+		super(parent);
+		this.owner = owner;
+		this.initializeXmlJavaTypeAdapter();			
+	}
+
+	public void synchronizeWithResourceModel() {
+		this.syncXmlJavaTypeAdapter();
+	}
+
+	public void update() {
+		this.updateXmlJavaTypeAdapter();
+	}
+
+	@Override
+	public TextRange getValidationTextRange(CompilationUnit astRoot) {
+		return this.xmlJavaTypeAdapter == null ? this.owner.getResource().getTextRange(astRoot) : this.xmlJavaTypeAdapter.getResourceXmlJavaTypeAdapter().getTextRange(astRoot);
+	}
+
+	public XmlJavaTypeAdapter getXmlJavaTypeAdapter() {
+		return this.xmlJavaTypeAdapter;
+	}
+
+	public XmlJavaTypeAdapter addXmlJavaTypeAdapter() {
+		if (this.xmlJavaTypeAdapter != null) {
+			throw new IllegalStateException();
+		}
+		XmlJavaTypeAdapterAnnotation annotation = (XmlJavaTypeAdapterAnnotation) this.owner.getResource().addAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+
+		XmlJavaTypeAdapter xmlJavaTypeAdapter = this.buildXmlJavaTypeAdapter(annotation);
+		this.setXmlJavaTypeAdapter_(xmlJavaTypeAdapter);
+		return xmlJavaTypeAdapter;
+	}
+
+	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
+		return this.owner.buildXmlJavaTypeAdapter(xmlJavaTypeAdapterAnnotation);
+	}
+
+	public void removeXmlJavaTypeAdapter() {
+		if (this.xmlJavaTypeAdapter == null) {
+			throw new IllegalStateException();
+		}
+		this.owner.getResource().removeAnnotation(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		this.setXmlJavaTypeAdapter_(null);
+	}
+
+	protected void initializeXmlJavaTypeAdapter() {
+		XmlJavaTypeAdapterAnnotation annotation = this.getXmlJavaTypeAdapterAnnotation();
+		if (annotation != null) {
+			this.xmlJavaTypeAdapter = this.buildXmlJavaTypeAdapter(annotation);
+		}
+	}
+
+	protected XmlJavaTypeAdapterAnnotation getXmlJavaTypeAdapterAnnotation() {
+		return (XmlJavaTypeAdapterAnnotation) this.owner.getResource().getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+
+	protected void syncXmlJavaTypeAdapter() {
+		XmlJavaTypeAdapterAnnotation annotation = this.getXmlJavaTypeAdapterAnnotation();
+		if (annotation != null) {
+			if (this.getXmlJavaTypeAdapter() != null) {
+				this.getXmlJavaTypeAdapter().synchronizeWithResourceModel();
+			}
+			else {
+				this.setXmlJavaTypeAdapter_(this.buildXmlJavaTypeAdapter(annotation));
+			}
+		}
+		else {
+			this.setXmlJavaTypeAdapter_(null);
+		}
+	}
+
+	protected void updateXmlJavaTypeAdapter() {
+		if (this.getXmlJavaTypeAdapter() != null) {
+			this.getXmlJavaTypeAdapter().update();
+		}
+	}
+
+	protected void setXmlJavaTypeAdapter_(XmlJavaTypeAdapter xmlJavaTypeAdapter) {
+		XmlJavaTypeAdapter oldXmlJavaTypeAdapter = this.xmlJavaTypeAdapter;
+		this.xmlJavaTypeAdapter = xmlJavaTypeAdapter;
+		this.owner.fireXmlAdapterChanged(oldXmlJavaTypeAdapter, xmlJavaTypeAdapter);
+	}
+	
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		if (getXmlJavaTypeAdapter() != null) {
+			this.getXmlJavaTypeAdapter().validate(messages, reporter, astRoot);
+		}
+	}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java
index 35f587e..4ac6236 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java
@@ -9,10 +9,18 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.internal.context.java;
 
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jpt.jaxb.core.MappingKeys;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.context.XmlAdaptable;
 import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 public class GenericJavaXmlAttributeMapping
 	extends AbstractJavaAttributeMapping<XmlAttributeAnnotation>
@@ -25,9 +33,12 @@
 
 	protected String specifiedNamespace;
 
+	protected final XmlAdaptable xmlAdaptable;
+
 	public GenericJavaXmlAttributeMapping(JaxbPersistentAttribute parent) {
 		super(parent);
 		this.specifiedRequired = this.buildSpecifiedRequired();
+		this.xmlAdaptable = this.buildXmlAdaptable();
 	}
 
 	public String getKey() {
@@ -45,6 +56,13 @@
 		this.setSpecifiedName_(this.buildSpecifiedName());
 		this.setSpecifiedRequired_(this.buildSpecifiedRequired());
 		this.setSpecifiedNamespace_(this.buildSpecifiedNamespace());
+		this.xmlAdaptable.synchronizeWithResourceModel();
+	}
+
+	@Override
+	public void update() {
+		super.update();
+		this.xmlAdaptable.update();
 	}
 
 	//************ XmlAttribute.name ***************
@@ -135,4 +153,46 @@
 	protected String buildSpecifiedNamespace() {
 		return getMappingAnnotation() == null ? null : getMappingAnnotation().getNamespace();
 	}
+
+
+	//****************** XmlJavaTypeAdapter *********************
+
+	public XmlAdaptable buildXmlAdaptable() {
+		return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() {
+			public JavaResourceAnnotatedElement getResource() {
+				return getJavaResourceAttribute();
+			}
+			public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) {
+				return GenericJavaXmlAttributeMapping.this.buildXmlJavaTypeAdapter(adapterAnnotation);
+			}
+			public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) {
+				GenericJavaXmlAttributeMapping.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter);
+			}
+		});
+	}
+
+	public XmlJavaTypeAdapter getXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.getXmlJavaTypeAdapter();
+	}
+
+	public XmlJavaTypeAdapter addXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.addXmlJavaTypeAdapter();
+	}
+
+	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
+		return new GenericJavaAttributeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation);
+	}
+
+	public void removeXmlJavaTypeAdapter() {
+		this.xmlAdaptable.removeXmlJavaTypeAdapter();
+	}
+
+
+	// ********** validation **********
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		this.xmlAdaptable.validate(messages, reporter, astRoot);
+	}
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java
index 88c36c8..9e16810 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java
@@ -9,10 +9,18 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.internal.context.java;
 
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jpt.jaxb.core.MappingKeys;
 import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.context.XmlAdaptable;
 import org.eclipse.jpt.jaxb.core.context.XmlElementMapping;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 
 public class GenericJavaXmlElementMapping
 	extends AbstractJavaAttributeMapping<XmlElementAnnotation>
@@ -31,6 +39,8 @@
 
 	protected String specifiedType;
 
+	protected final XmlAdaptable xmlAdaptable;
+
 	public GenericJavaXmlElementMapping(JaxbPersistentAttribute parent) {
 		super(parent);
 		this.specifiedName = this.buildSpecifiedName();
@@ -39,6 +49,7 @@
 		this.specifiedNamespace = this.buildSpecifiedNamespace();
 		this.defaultValue = this.buildDefaultValue();
 		this.specifiedType = this.buildSpecifiedType();
+		this.xmlAdaptable = this.buildXmlAdaptable();
 	}
 
 	public String getKey() {
@@ -59,6 +70,13 @@
 		this.setSpecifiedNamespace_(this.buildSpecifiedNamespace());
 		this.setDefaultValue_(this.buildDefaultValue());
 		this.setSpecifiedType_(this.buildSpecifiedType());
+		this.xmlAdaptable.synchronizeWithResourceModel();
+	}
+
+	@Override
+	public void update() {
+		super.update();
+		this.xmlAdaptable.update();
 	}
 
 	//************ XmlElement.name ***************
@@ -231,4 +249,45 @@
 		return getMappingAnnotation() == null ? null : getMappingAnnotation().getType();
 	}
 
+
+	//****************** XmlJavaTypeAdapter *********************
+
+	public XmlAdaptable buildXmlAdaptable() {
+		return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() {
+			public JavaResourceAnnotatedElement getResource() {
+				return getJavaResourceAttribute();
+			}
+			public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) {
+				return GenericJavaXmlElementMapping.this.buildXmlJavaTypeAdapter(adapterAnnotation);
+			}
+			public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) {
+				GenericJavaXmlElementMapping.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter);
+			}
+		});
+	}
+
+	public XmlJavaTypeAdapter getXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.getXmlJavaTypeAdapter();
+	}
+
+	public XmlJavaTypeAdapter addXmlJavaTypeAdapter() {
+		return this.xmlAdaptable.addXmlJavaTypeAdapter();
+	}
+
+	protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) {
+		return new GenericJavaAttributeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation);
+	}
+
+	public void removeXmlJavaTypeAdapter() {
+		this.xmlAdaptable.removeXmlJavaTypeAdapter();
+	}
+
+
+	// ********** validation **********
+
+	@Override
+	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+		super.validate(messages, reporter, astRoot);
+		this.xmlAdaptable.validate(messages, reporter, astRoot);
+	}
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlJavaTypeAdapter.java
deleted file mode 100644
index 2a899e0..0000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlJavaTypeAdapter.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.context.java;
-
-import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
-import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
-import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
-
-public class GenericJavaXmlJavaTypeAdapter
-	extends AbstractJaxbContextNode
-	implements XmlJavaTypeAdapter
-{
-
-	protected final XmlJavaTypeAdapterAnnotation resourceXmlJavaTypeAdapter;
-
-	protected String value;
-
-	protected String type;
-
-	public GenericJavaXmlJavaTypeAdapter(JaxbContextNode parent, XmlJavaTypeAdapterAnnotation resource) {
-		super(parent);
-		this.resourceXmlJavaTypeAdapter = resource;
-		this.value = this.getResourceValue();
-		this.type = this.getResourceTypeString();
-	}
-
-
-	// ********** synchronize/update **********
-
-	public void synchronizeWithResourceModel() {
-		this.setValue_(this.getResourceValue());
-		this.setType_(this.getResourceTypeString());
-	}
-
-	public void update() {
-		//nothing yet
-	}
-
-
-	// ********** xml java type adapter annotation **********
-
-	public XmlJavaTypeAdapterAnnotation getResourceXmlJavaTypeAdapter() {
-		return this.resourceXmlJavaTypeAdapter;
-	}
-
-	// ********** value **********
-
-	public String getValue() {
-		return this.value;
-	}
-
-	public void setValue(String value) {
-		this.resourceXmlJavaTypeAdapter.setValue(value);
-		this.setValue_(value);	
-	}
-
-	protected void setValue_(String value) {
-		String old = this.value;
-		this.value = value;
-		this.firePropertyChanged(VALUE_PROPERTY, old, value);
-	}
-
-	protected String getResourceValue() {
-		return this.resourceXmlJavaTypeAdapter.getValue();
-	}
-
-
-	// ********** type **********
-
-	public String getType() {
-		return this.type;
-	}
-
-	public void setType(String location) {
-		this.resourceXmlJavaTypeAdapter.setType(location);
-		this.setType_(location);	
-	}
-
-	protected void setType_(String type) {
-		String old = this.type;
-		this.type = type;
-		this.firePropertyChanged(TYPE_PROPERTY, old, type);
-	}
-
-	protected String getResourceTypeString() {
-		return this.resourceXmlJavaTypeAdapter.getType();
-	}
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java
index 465b6aa..a713742 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java
@@ -129,11 +129,9 @@
 	private void syncModifiers(int astModifiers) {
 		int old = this.modifiers;
 		this.modifiers = astModifiers;
-		this.firePropertyChanged(getModifiersProperty(), old, astModifiers);
+		this.firePropertyChanged(MODIFIERS_PROPERTY, old, astModifiers);
 	}
 
-	protected abstract String getModifiersProperty();
-
 	/**
 	 * zero seems like a reasonable default...
 	 */
@@ -150,11 +148,9 @@
 	private void syncTypeName(String astTypeName) {
 		String old = this.typeName;
 		this.typeName = astTypeName;
-		this.firePropertyChanged(getTypeNameProperty(), old, astTypeName);
+		this.firePropertyChanged(TYPE_NAME_PROPERTY, old, astTypeName);
 	}
 
-	protected abstract String getTypeNameProperty();
-
 	/**
 	 * this can be an array (e.g. "java.lang.String[]");
 	 * but no generic type arguments
@@ -182,11 +178,9 @@
 	private void syncTypeIsInterface(boolean astTypeIsInterface) {
 		boolean old = this.typeIsInterface;
 		this.typeIsInterface = astTypeIsInterface;
-		this.firePropertyChanged(getTypeIsInterfaceProperty(), old, astTypeIsInterface);
+		this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, astTypeIsInterface);
 	}
 
-	protected abstract String getTypeIsInterfaceProperty();
-
 	private boolean buildTypeIsInterface(ITypeBinding typeBinding) {
 		return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface();
 	}
@@ -199,11 +193,9 @@
 	private void syncTypeIsEnum(boolean astTypeIsEnum) {
 		boolean old = this.typeIsEnum;
 		this.typeIsEnum = astTypeIsEnum;
-		this.firePropertyChanged(getTypeIsEnumProperty(), old, astTypeIsEnum);
+		this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, astTypeIsEnum);
 	}
 
-	protected abstract String getTypeIsEnumProperty();
-
 	private boolean buildTypeIsEnum(ITypeBinding typeBinding) {
 		return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum();
 	}
@@ -214,11 +206,9 @@
 	}
 
 	private void syncTypeSuperclassNames(List<String> astTypeSuperclassNames) {
-		this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, getTypeSuperclassNamesProperty());
+		this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
 	}
 
-	protected abstract String getTypeSuperclassNamesProperty();
-
 	private List<String> buildTypeSuperclassNames(ITypeBinding typeBinding) {
 		if (typeBinding == null) {
 			return Collections.emptyList();
@@ -242,11 +232,9 @@
 //	}
 //
 	private void syncTypeInterfaceNames(Collection<String> astTypeInterfaceNames) {
-		this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, getTypeInterfaceNamesProperty());
+		this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
 	}
 
-	protected abstract String getTypeInterfaceNamesProperty();
-
 	private Collection<String> buildTypeInterfaceNames(ITypeBinding typeBinding) {
 		if (typeBinding == null) {
 			return Collections.emptySet();
@@ -280,11 +268,9 @@
 	}
 
 	private void syncTypeTypeArgumentNames(List<String> astTypeTypeArgumentNames) {
-		this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, this.getTypeTypeArgumentNamesProperty());
+		this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
 	}
 
-	protected abstract String getTypeTypeArgumentNamesProperty();
-
 	/**
 	 * these types can be arrays (e.g. "java.lang.String[]");
 	 * but they won't have any further nested generic type arguments
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java
index c735914..742fac9 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 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.
@@ -50,45 +50,4 @@
 	private SourceField(JavaResourceType parent, FieldAttribute field){
 		super(parent, field);
 	}
-
-
-	// ******** SourceAttribute implementation ********
-
-	@Override
-	protected String getModifiersProperty() {
-		return MODIFIERS_PROPERTY;
-	}
-
-	@Override
-	protected String getTypeNameProperty() {
-		return TYPE_NAME_PROPERTY;
-	}
-
-	@Override
-	protected String getTypeIsInterfaceProperty() {
-		return TYPE_IS_INTERFACE_PROPERTY;
-	}
-
-	@Override
-	protected String getTypeIsEnumProperty() {
-		return TYPE_IS_ENUM_PROPERTY;
-	}
-
-	@Override
-	protected String getTypeSuperclassNamesProperty() {
-		return TYPE_SUPERCLASS_NAMES_LIST;
-	}
-
-	@Override
-	protected String getTypeInterfaceNamesProperty() {
-		return TYPE_INTERFACE_NAMES_COLLECTION;
-	}
-
-	@Override
-	protected String getTypeTypeArgumentNamesProperty() {
-		return TYPE_TYPE_ARGUMENT_NAMES_LIST;
-	}
-	
-
-
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java
index 7aa53a8..47cd244 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -123,85 +123,6 @@
 		return this.annotatedElement.matches(signature, occurrence);
 	}
 
-	public boolean returnTypeIsSubTypeOf(String tn) {
-		return this.typeIsSubTypeOf(tn);
-	}
-
-	public boolean returnTypeIsVariablePrimitive() {
-		return this.typeIsVariablePrimitive();
-	}
-
-	public int getReturnTypeModifiers() {
-		return this.getModifiers();
-	}
-
-	@Override
-	protected String getModifiersProperty() {
-		return RETURN_TYPE_MODIFIERS_PROPERTY;
-	}
-
-	public String getReturnTypeName() {
-		return this.getTypeName();
-	}
-
-	@Override
-	protected String getTypeNameProperty() {
-		return RETURN_TYPE_NAME_PROPERTY;
-	}
-
-	public boolean returnTypeIsInterface() {
-		return this.typeIsInterface();
-	}
-
-	@Override
-	protected String getTypeIsInterfaceProperty() {
-		return RETURN_TYPE_IS_INTERFACE_PROPERTY;
-	}
-
-	public boolean returnTypeIsEnum() {
-		return this.typeIsEnum();
-	}
-
-	@Override
-	protected String getTypeIsEnumProperty() {
-		return RETURN_TYPE_IS_ENUM_PROPERTY;
-	}
-
-	public ListIterable<String> getReturnTypeSuperclassNames() {
-		return this.getTypeSuperclassNames();
-	}
-
-	@Override
-	protected String getTypeSuperclassNamesProperty() {
-		return RETURN_TYPE_SUPERCLASS_NAMES_LIST;
-	}
-
-	public Iterable<String> getReturnTypeInterfaceNames() {
-		return this.getTypeInterfaceNames();
-	}
-
-	@Override
-	protected String getTypeInterfaceNamesProperty() {
-		return RETURN_TYPE_INTERFACE_NAMES_COLLECTION;
-	}
-
-	public ListIterable<String> getReturnTypeTypeArgumentNames() {
-		return this.getTypeTypeArgumentNames();
-	}
-
-	@Override
-	protected String getTypeTypeArgumentNamesProperty() {
-		return RETURN_TYPE_TYPE_ARGUMENT_NAMES_LIST;
-	}
-
-	public int getReturnTypeTypeArgumentNamesSize() {
-		return this.getTypeTypeArgumentNamesSize();
-	}
-
-	public String getReturnTypeTypeArgumentName(int index) {
-		return this.getTypeTypeArgumentName(index);
-	}
-
 	// ***** parameter type names
 	public ListIterable<String> getParameterTypeNames() {
 		return new LiveCloneListIterable<String>(this.parameterTypeNames);
@@ -212,7 +133,7 @@
 	}
 
 	private void syncParameterTypeNames(List<String> astParameterTypeNames) {
-		this.synchronizeList(astParameterTypeNames, this.parameterTypeNames, getTypeSuperclassNamesProperty());
+		this.synchronizeList(astParameterTypeNames, this.parameterTypeNames, PARAMETER_TYPE_NAMES_LIST);
 	}
 
 	private List<String> buildParameterTypeNames(IMethodBinding methodBinding) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java
index 901e384..1af5966 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -20,11 +20,16 @@
 	
 	// validation on package
 	public static final String PACKAGE_NO_SCHEMA_FOR_NAMESPACE = "PACKAGE_NO_SCHEMA_FOR_NAMESPACE";
+	public static final String PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED = "PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED";
 	
 	// validation on type
 	public static final String XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE = "XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE";
 	public static final String XML_TYPE_UNRESOLVED_SCHEMA_TYPE = "XML_TYPE_UNRESOLVED_SCHEMA_TYPE";
-	
+
 	public static final String XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT = "XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT";
 	public static final String XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE = "XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE";
+	
+	// validation on attribute mapping
+	public static final String ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED = "ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED";
+
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java
index b8d41b2..23385f8 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java
@@ -9,6 +9,8 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.resource.java;
 
+import org.eclipse.jpt.utility.internal.iterables.ListIterable;
+
 /**
  * Java source code or binary attribute (field/method)
  * 
@@ -25,4 +27,72 @@
 	extends JavaResourceMember
 {
 
+	/**
+	 * Return whether the attribute's type implements or extends the specified
+	 * type.
+	 */
+	boolean typeIsSubTypeOf(String typeName);
+
+	/**
+	 * Return whether the attribute's type is a "variable" primitive type
+	 * (i.e. any primitive type except 'void').
+	 */
+	boolean typeIsVariablePrimitive();
+
+	/**
+	 * @see java.lang.reflect.Modifier
+	 */
+	int getModifiers();
+		String MODIFIERS_PROPERTY = "modifiers"; //$NON-NLS-1$
+
+	/**
+	 * Return the resolved, qualified name of the attribute's type
+	 * (e.g. "java.util.Collection" or "byte[]").
+	 * If the type is an array, this name will include the appropriate number
+	 * of bracket pairs.
+	 * This name will not include the type's generic type arguments
+	 * (e.g. "java.util.Collection<java.lang.String>" will only return
+	 * "java.util.Collection").
+	 * @see #typeTypeArgumentNames()
+	 */
+	String getTypeName();
+		String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$
+
+	/**
+	 * Return whether the attribute type is an interface.
+	 */
+	boolean typeIsInterface();
+		String TYPE_IS_INTERFACE_PROPERTY = "typeIsInterface"; //$NON-NLS-1$
+
+	/**
+	 * Return whether the attribute type is an enum.
+	 */
+	boolean typeIsEnum();
+		String TYPE_IS_ENUM_PROPERTY = "typeIsEnum"; //$NON-NLS-1$
+
+	/**
+	 * Return the names of the attribute type's superclasses.
+	 */
+	ListIterable<String> getTypeSuperclassNames();
+		String TYPE_SUPERCLASS_NAMES_LIST = "typeSuperclassNames"; //$NON-NLS-1$
+
+	/**
+	 * Return the names of the attribute type's interfaces.
+	 */
+	Iterable<String> getTypeInterfaceNames();
+		String TYPE_INTERFACE_NAMES_COLLECTION = "typeInterfaceNames"; //$NON-NLS-1$
+
+	/**
+	 * Return the names of the attribute type's type arguments.
+	 * The name for any argument that is an array will contain the appropriate
+	 * number of bracket pairs.
+	 * The names will not include any further generic type arguments.
+	 */
+	ListIterable<String> getTypeTypeArgumentNames();
+		String TYPE_TYPE_ARGUMENT_NAMES_LIST = "typeTypeArgumentNames"; //$NON-NLS-1$
+
+	int getTypeTypeArgumentNamesSize();
+
+	String getTypeTypeArgumentName(int index);
+
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java
index 03cd4ca..a5c82bd 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java
@@ -9,8 +9,6 @@
  ******************************************************************************/
 package org.eclipse.jpt.jaxb.core.resource.java;
 
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-
 /**
  * Java source code or binary field
  * 
@@ -26,73 +24,4 @@
 public interface JavaResourceField
 	extends JavaResourceAttribute
 {
-
-	/**
-	 * Return whether the attribute's type implements or extends the specified
-	 * type.
-	 */
-	boolean typeIsSubTypeOf(String typeName);
-
-	/**
-	 * Return whether the attribute's type is a "variable" primitive type
-	 * (i.e. any primitive type except 'void').
-	 */
-	boolean typeIsVariablePrimitive();
-
-	/**
-	 * @see java.lang.reflect.Modifier
-	 */
-	int getModifiers();
-		String MODIFIERS_PROPERTY = "modifiers"; //$NON-NLS-1$
-
-	/**
-	 * Return the resolved, qualified name of the attribute's type
-	 * (e.g. "java.util.Collection" or "byte[]").
-	 * If the type is an array, this name will include the appropriate number
-	 * of bracket pairs.
-	 * This name will not include the type's generic type arguments
-	 * (e.g. "java.util.Collection<java.lang.String>" will only return
-	 * "java.util.Collection").
-	 * @see #typeTypeArgumentNames()
-	 */
-	String getTypeName();
-		String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$
-
-	/**
-	 * Return whether the attribute type is an interface.
-	 */
-	boolean typeIsInterface();
-		String TYPE_IS_INTERFACE_PROPERTY = "typeIsInterface"; //$NON-NLS-1$
-
-	/**
-	 * Return whether the attribute type is an enum.
-	 */
-	boolean typeIsEnum();
-		String TYPE_IS_ENUM_PROPERTY = "typeIsEnum"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the attribute type's superclasses.
-	 */
-	ListIterable<String> getTypeSuperclassNames();
-		String TYPE_SUPERCLASS_NAMES_LIST = "typeSuperclassNames"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the attribute type's interfaces.
-	 */
-	Iterable<String> getTypeInterfaceNames();
-		String TYPE_INTERFACE_NAMES_COLLECTION = "typeInterfaceNames"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the attribute type's type arguments.
-	 * The name for any argument that is an array will contain the appropriate
-	 * number of bracket pairs.
-	 * The names will not include any further generic type arguments.
-	 */
-	ListIterable<String> getTypeTypeArgumentNames();
-		String TYPE_TYPE_ARGUMENT_NAMES_LIST = "typeTypeArgumentNames"; //$NON-NLS-1$
-
-	int getTypeTypeArgumentNamesSize();
-
-	String getTypeTypeArgumentName(int index);
-
 }
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java
index 55e0f2c..f1f3c77 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java
@@ -39,74 +39,6 @@
 	 */
 	boolean isFor(MethodSignature methodSignature, int occurrence);
 
-	/**
-	 * Return whether the method's return type implements or extends the specified
-	 * type.
-	 */
-	boolean returnTypeIsSubTypeOf(String typeName);
-
-	/**
-	 * Return whether the method's return type is a "variable" primitive type
-	 * (i.e. any primitive type except 'void').
-	 */
-	boolean returnTypeIsVariablePrimitive();
-
-	/**
-	 * @see java.lang.reflect.Modifier
-	 */
-	int getReturnTypeModifiers();
-		String RETURN_TYPE_MODIFIERS_PROPERTY = "returnTypeModifiers"; //$NON-NLS-1$
-
-	/**
-	 * Return the resolved, qualified name of the method's return type
-	 * (e.g. "java.util.Collection" or "byte[]").
-	 * If the return type is an array, this name will include the appropriate number
-	 * of bracket pairs.
-	 * This name will not include the return type's generic type arguments
-	 * (e.g. "java.util.Collection<java.lang.String>" will only return
-	 * "java.util.Collection").
-	 * @see #returnTypeTypeArgumentNames()
-	 */
-	String getReturnTypeName();
-		String RETURN_TYPE_NAME_PROPERTY = "returnTypeName"; //$NON-NLS-1$
-
-	/**
-	 * Return whether the method return type is an interface.
-	 */
-	boolean returnTypeIsInterface();
-		String RETURN_TYPE_IS_INTERFACE_PROPERTY = "returnTypeIsInterface"; //$NON-NLS-1$
-
-	/**
-	 * Return whether the method return type is an enum.
-	 */
-	boolean returnTypeIsEnum();
-		String RETURN_TYPE_IS_ENUM_PROPERTY = "returnTypeIsEnum"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the method return type's superclasses.
-	 */
-	ListIterable<String> getReturnTypeSuperclassNames();
-		String RETURN_TYPE_SUPERCLASS_NAMES_LIST = "returnTypeSuperclassNames"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the method return type's interfaces.
-	 */
-	Iterable<String> getReturnTypeInterfaceNames();
-		String RETURN_TYPE_INTERFACE_NAMES_COLLECTION = "returnTypeInterfaceNames"; //$NON-NLS-1$
-
-	/**
-	 * Return the names of the method return type's type arguments.
-	 * The name for any argument that is an array will contain the appropriate
-	 * number of bracket pairs.
-	 * The names will not include any further generic type arguments.
-	 */
-	ListIterable<String> getReturnTypeTypeArgumentNames();
-		String RETURN_TYPE_TYPE_ARGUMENT_NAMES_LIST = "returnTypeTypeArgumentNames"; //$NON-NLS-1$
-
-	int getReturnTypeTypeArgumentNamesSize();
-
-	String getReturnTypeTypeArgumentName(int index);
-
 	ListIterable<String> getParameterTypeNames();
 		String PARAMETER_TYPE_NAMES_LIST = "parameterTypeNames"; //$NON-NLS-1$
 
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java
new file mode 100644
index 0000000..98a7abd
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
+import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+
+@SuppressWarnings("nls")
+public class GenericJavaAttributeXmlJavaTypeAdapterTests extends JaxbContextModelTestCase
+{
+
+	public GenericJavaAttributeXmlJavaTypeAdapterTests(String name) {
+		super(name);
+	}
+
+	private ICompilationUnit createTypeWithXmlTypeWithXmlJavaTypeAdapter() throws Exception {
+		return this.createTestType(new DefaultAnnotationWriter() {
+			@Override
+			public Iterator<String> imports() {
+				return new ArrayIterator<String>(JAXB.XML_TYPE, JAXB.XML_ATTRIBUTE, JAXB.XML_JAVA_TYPE_ADAPTER);
+			}
+			@Override
+			public void appendTypeAnnotationTo(StringBuilder sb) {
+				sb.append("@XmlType").append(CR);
+			}
+			@Override
+			public void appendIdFieldAnnotationTo(StringBuilder sb) {
+				sb.append("@XmlAttribute").append(CR);
+				sb.append("@XmlJavaTypeAdapter");
+			}
+		});
+	}
+
+	public void testModifyValue() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		XmlAttributeMapping contextAttributeMapping =  (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping();
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter();
+		JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute();
+
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+
+		contextXmlJavaTypeAdapter.setValue("foo");
+		XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertEquals("foo", javaTypeAdapterAnnotation.getValue());
+		assertEquals("foo", contextXmlJavaTypeAdapter.getValue());
+
+		 //verify the xml schema type annotation is not removed when the value is set to null
+		contextXmlJavaTypeAdapter.setValue(null);
+		javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(javaTypeAdapterAnnotation.getValue());
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+	}
+
+	public void testUpdateValue() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		XmlAttributeMapping contextAttributeMapping =  (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping();
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter();
+		JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute();
+
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+
+		//add a value member value pair
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaAttributeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String");
+			}
+		});
+		assertEquals("String", contextXmlJavaTypeAdapter.getValue());
+
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaAttributeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+			}
+		});
+		assertNull(contextAttributeMapping.getXmlJavaTypeAdapter());
+	}
+
+	public void testModifyType() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		XmlAttributeMapping contextAttributeMapping =  (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping();
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter();
+		JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute();
+
+		assertEquals("int", contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType());
+
+		contextXmlJavaTypeAdapter.setSpecifiedType("foo");
+		XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertEquals("foo", javaTypeAdapterAnnotation.getType());
+		assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType());
+
+		contextXmlJavaTypeAdapter.setSpecifiedType(null);
+		javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(javaTypeAdapterAnnotation.getType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType());
+	}
+
+	public void testUpdateType() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		XmlAttributeMapping contextAttributeMapping =  (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping();
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter();
+		JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute();
+
+		assertEquals("int", contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType());
+
+		//add a type member value pair
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaAttributeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String");
+			}
+		});
+		assertEquals("String", contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("String", contextXmlJavaTypeAdapter.getType());
+		assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType());
+
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaAttributeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+			}
+		});
+		assertNull(contextAttributeMapping.getXmlJavaTypeAdapter());
+	}
+
+	protected void addXmlJavaTypeAdapterTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) {
+		this.addMemberValuePair(
+			(MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), 
+			name, 
+			this.newTypeLiteral(declaration.getAst(), typeName));
+	}
+
+	protected void addXmlJavaTypeAdapterMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
+		this.addMemberValuePair((MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), name, value);
+	}
+
+	protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) {
+		this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);		
+	}
+
+	protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) {
+		return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java
similarity index 85%
rename from jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlJavaTypeAdapterTests.java
rename to jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java
index 9501b07..5331da0 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlJavaTypeAdapterTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -27,10 +27,10 @@
 
 
 @SuppressWarnings("nls")
-public class GenericJavaXmlJavaTypeAdapterTests extends JaxbContextModelTestCase
+public class GenericJavaPackageXmlJavaTypeAdapterTests extends JaxbContextModelTestCase
 {
 
-	public GenericJavaXmlJavaTypeAdapterTests(String name) {
+	public GenericJavaPackageXmlJavaTypeAdapterTests(String name) {
 		super(name);
 	}
 
@@ -73,14 +73,14 @@
 		AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
 		annotatedElement.edit(new Member.Editor() {
 			public void edit(ModifiedDeclaration declaration) {
-				GenericJavaXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String");
+				GenericJavaPackageXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String");
 			}
 		});
 		assertEquals("String", contextXmlJavaTypeAdapter.getValue());
 
 		annotatedElement.edit(new Member.Editor() {
 			public void edit(ModifiedDeclaration declaration) {
-				GenericJavaXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+				GenericJavaPackageXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
 			}
 		});
 		assertFalse(contextPackageInfo.getXmlJavaTypeAdapters().iterator().hasNext());
@@ -93,17 +93,21 @@
 		JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
 
 		assertNull(contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertNull(contextXmlJavaTypeAdapter.getDefaultType());
 
-		contextXmlJavaTypeAdapter.setType("foo");
+		contextXmlJavaTypeAdapter.setSpecifiedType("foo");
 		XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
 		assertEquals("foo", javaTypeAdapterAnnotation.getType());
 		assertEquals("foo", contextXmlJavaTypeAdapter.getType());
 
 		 //verify the xml schema type annotation is not removed when the type is set to null
-		contextXmlJavaTypeAdapter.setType(null);
+		contextXmlJavaTypeAdapter.setSpecifiedType(null);
 		javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
 		assertNull(javaTypeAdapterAnnotation.getType());
 		assertNull(contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertNull(contextXmlJavaTypeAdapter.getDefaultType());
 	}
 
 	public void testUpdateType() throws Exception {
@@ -113,19 +117,21 @@
 		JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
 
 		assertNull(contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertNull(contextXmlJavaTypeAdapter.getDefaultType());
 
 		//add a type member value pair
 		AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
 		annotatedElement.edit(new Member.Editor() {
 			public void edit(ModifiedDeclaration declaration) {
-				GenericJavaXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String");
+				GenericJavaPackageXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String");
 			}
 		});
 		assertEquals("String", contextXmlJavaTypeAdapter.getType());
 
 		annotatedElement.edit(new Member.Editor() {
 			public void edit(ModifiedDeclaration declaration) {
-				GenericJavaXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+				GenericJavaPackageXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
 			}
 		});
 		assertFalse(contextPackageInfo.getXmlJavaTypeAdapters().iterator().hasNext());
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java
index 4596b28..88fa580 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -42,6 +42,7 @@
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation;
@@ -2012,6 +2013,58 @@
 		this.addModifiers(resourceSetter, ModifierKeyword.PUBLIC_KEYWORD);
 	}
 
+	public void testModifyXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlType();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(persistentClass.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+		persistentClass.addXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(persistentClass.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		persistentClass.removeXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+
+	public void testUpdateXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlType();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(persistentClass.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+
+		//add an XmlJavaTypeAdapter annotation
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceType);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(persistentClass.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		//remove the XmlJavaTypeAdapter annotation
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(persistentClass.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+	}
+
 	protected void addModifiers(JavaResourceMember resourceMember, final ModifierKeyword... modifiers) {
 		AnnotatedElement annotatedElement = this.annotatedElement(resourceMember);
 		annotatedElement.edit(new Member.Editor() {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java
new file mode 100644
index 0000000..a295d82
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass;
+import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
+import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+
+@SuppressWarnings("nls")
+public class GenericJavaTypeXmlJavaTypeAdapterTests extends JaxbContextModelTestCase
+{
+
+	public GenericJavaTypeXmlJavaTypeAdapterTests(String name) {
+		super(name);
+	}
+
+	private ICompilationUnit createTypeWithXmlTypeWithXmlJavaTypeAdapter() throws Exception {
+		return this.createTestType(new DefaultAnnotationWriter() {
+			@Override
+			public Iterator<String> imports() {
+				return new ArrayIterator<String>(JAXB.XML_TYPE, JAXB.XML_JAVA_TYPE_ADAPTER);
+			}
+			@Override
+			public void appendTypeAnnotationTo(StringBuilder sb) {
+				sb.append("@XmlType").append(CR);
+				sb.append("@XmlJavaTypeAdapter");
+			}
+		});
+	}
+
+	public void testModifyValue() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter();
+		JavaResourceType resourceType = contextPersistentClass.getJavaResourceType();
+
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+
+		contextXmlJavaTypeAdapter.setValue("foo");
+		XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertEquals("foo", javaTypeAdapterAnnotation.getValue());
+		assertEquals("foo", contextXmlJavaTypeAdapter.getValue());
+
+		 //verify the xml schema type annotation is not removed when the value is set to null
+		contextXmlJavaTypeAdapter.setValue(null);
+		javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(javaTypeAdapterAnnotation.getValue());
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+	}
+
+	public void testUpdateValue() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter();
+		JavaResourceType resourceType = contextPersistentClass.getJavaResourceType();
+
+		assertNull(contextXmlJavaTypeAdapter.getValue());
+
+		//add a value member value pair
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceType);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaTypeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String");
+			}
+		});
+		assertEquals("String", contextXmlJavaTypeAdapter.getValue());
+
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaTypeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+			}
+		});
+		assertNull(contextPersistentClass.getXmlJavaTypeAdapter());
+	}
+
+	public void testModifyType() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter();
+		JavaResourceType resourceType = contextPersistentClass.getJavaResourceType();
+
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType());
+
+		contextXmlJavaTypeAdapter.setSpecifiedType("foo");
+		XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertEquals("foo", javaTypeAdapterAnnotation.getType());
+		assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType());
+
+		contextXmlJavaTypeAdapter.setSpecifiedType(null);
+		javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(javaTypeAdapterAnnotation.getType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType());
+	}
+
+	public void testUpdateType() throws Exception {
+		this.createTypeWithXmlTypeWithXmlJavaTypeAdapter();
+		JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter();
+		JavaResourceType resourceType = contextPersistentClass.getJavaResourceType();
+
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType());
+		assertNull(contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType());
+
+		//add a type member value pair
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceType);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaTypeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String");
+			}
+		});
+		assertEquals("String", contextXmlJavaTypeAdapter.getSpecifiedType());
+		assertEquals("String", contextXmlJavaTypeAdapter.getType());
+		assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType());
+
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaTypeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration);
+			}
+		});
+		assertNull(contextPersistentClass.getXmlJavaTypeAdapter());
+	}
+
+	protected void addXmlJavaTypeAdapterTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) {
+		this.addMemberValuePair(
+			(MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), 
+			name, 
+			this.newTypeLiteral(declaration.getAst(), typeName));
+	}
+
+	protected void addXmlJavaTypeAdapterMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
+		this.addMemberValuePair((MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), name, value);
+	}
+
+	//add another package annotation so that the context model object doesn't get removed when 
+	//removing the XmlJavaTypeAdapter annotation. Only "annotated" packages are added to the context model
+	protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) {
+		this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME);
+		this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);		
+	}
+
+	protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) {
+		return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
index db829b0..c5d0799 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java
@@ -26,6 +26,7 @@
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
 import org.eclipse.jpt.utility.internal.CollectionTools;
 import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -244,6 +245,61 @@
 		assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME));
 	}
 
+	public void testModifyXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlAttribute();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0);
+		XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
+		JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+		xmlAttributeMapping.addXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		xmlAttributeMapping.removeXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+
+	public void testUpdateXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlAttribute();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0);
+		XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping();
+		JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+
+		//add an XmlJavaTypeAdapter annotation
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		//remove the XmlJavaTypeAdapter annotation
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+	}
 
 	protected void addXmlAttributeMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
 		this.addMemberValuePair((MarkerAnnotation) this.getXmlAttributeAnnotation(declaration), name, value);
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
index 5f389f2..132ba6c 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java
@@ -26,6 +26,7 @@
 import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
 import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
+import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
 import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase;
 import org.eclipse.jpt.utility.internal.CollectionTools;
 import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -403,6 +404,62 @@
 		assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME));
 	}
 
+	public void testModifyXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlElement();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0);
+		XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
+		JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+		xmlElementMapping.addXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		xmlElementMapping.removeXmlJavaTypeAdapter();
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+	}
+
+	public void testUpdateXmlJavaTypeAdapter() throws Exception {
+		createTypeWithXmlElement();
+
+		JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0);
+		JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0);
+		XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping();
+		JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute();
+
+		XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+
+
+		//add an XmlJavaTypeAdapter annotation
+		AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter());
+		assertNotNull(xmlJavaTypeAdapterAnnotation);
+
+		//remove the XmlJavaTypeAdapter annotation
+		annotatedElement.edit(new Member.Editor() {
+			public void edit(ModifiedDeclaration declaration) {
+				GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+			}
+		});
+		xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME);
+		assertNull(xmlElementMapping.getXmlJavaTypeAdapter());
+		assertNull(xmlJavaTypeAdapterAnnotation);
+	}
+
 	protected void addXmlElementMemberValuePair(ModifiedDeclaration declaration, String name, String value) {
 		this.addMemberValuePair((MarkerAnnotation) this.getXmlElementAnnotation(declaration), name, value);
 	}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java
index c7dec95..e9c0bee 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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.
@@ -20,12 +20,14 @@
 		suite.addTestSuite(GenericJavaElementFactoryMethodTests.class);
 		suite.addTestSuite(GenericJavaEnumConstantTests.class);
 		suite.addTestSuite(GenericJavaPackageInfoTests.class);
+		suite.addTestSuite(GenericJavaPackageXmlJavaTypeAdapterTests.class);
+		suite.addTestSuite(GenericJavaTypeXmlJavaTypeAdapterTests.class);
+		suite.addTestSuite(GenericJavaAttributeXmlJavaTypeAdapterTests.class);
 		suite.addTestSuite(GenericJavaPersistentClassTests.class);
 		suite.addTestSuite(GenericJavaPersistentEnumTests.class);
 		suite.addTestSuite(GenericJavaRegistryTests.class);
 		suite.addTestSuite(GenericJavaXmlAttributeMappingTests.class);
 		suite.addTestSuite(GenericJavaXmlElementMappingTests.class);
-		suite.addTestSuite(GenericJavaXmlJavaTypeAdapterTests.class);
 		suite.addTestSuite(GenericJavaXmlRootElementTests.class);
 		suite.addTestSuite(GenericJavaXmlSchemaTests.class);
 		suite.addTestSuite(GenericJavaXmlSchemaTypeTests.class);