Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322839

Summary: JAXB Externalized Metadata: Support for xml-any-attribute with Dynamic JAXB
Product: z_Archived Reporter: Rick Barkhouse <rick.barkhouse>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: rick.barkhouse
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch.
none
Patch. none

Description Rick Barkhouse CLA 2010-08-16 16:27:42 EDT
When using an XmlAnyAttribute, two conditions must be true:

- The Java attribute must be assignable to java.util.Map
- The key/value types for the Map must be <QName, Object>

In Dynamic JAXB, all attributes are of type Object unless they are overridden in the OXM file.  However, in this case the attribute must be types in a very specific way, so we can just assume that this attribute should be typed as Map<QName, Object>.

In XmlProcessor, when we are processing xml-any-attribute, we should make a special case for OXMJavaClasses:

// process xml-any-attribute
if (javaAttributeClass != Map) {
   if (javaType instanceof OXMJavaClassImpl) {
      // set type to be Map<QName, Object>
   } else {
      throw Exception("Attribute must be of type Map");
   }
}
Comment 1 Rick Barkhouse CLA 2010-08-17 15:13:31 EDT
Created attachment 176833 [details]
Proposed patch.
Comment 2 Rick Barkhouse CLA 2010-08-18 09:32:28 EDT
Created attachment 176889 [details]
Patch.
Comment 3 Rick Barkhouse CLA 2010-08-18 09:33:31 EDT
Fixed, reviewed by dmccann.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:16:55 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:20:44 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink