jaxb-ri icon indicating copy to clipboard operation
jaxb-ri copied to clipboard

Infer generic components for XmlAdapter

Open Tomas-Kraus opened this issue 18 years ago • 4 comments

As discussed in http://forums.java.net/jive/thread.jspa?threadID=17972 .

XmlAdapter should be extended to support inference of the component types of the type it is annotated on. This would allow for creation of a single generic XmlAdapter, instead of creating separate XmlAdapters for each different set of component types. This most directly affects users of Map types to emulate Map functionality over SOAP.

e.g. instead of creating separate XmlAdapters for each different key-value type pair, one could create:

public class MapAdapter<K,V> extends XmlAdapter<MapEntity<K,V>[], Map<K,V>>

where MapEntity is a simple user class, consisting of a generic key and value field.

This sort of functionality could be further integrated to automatically make use of the MapEntity class (which I would be happy to provide, even though it's dead-simple) whenever a Map type is encountered. This would bring JAXB more in line with the existing vendor-specific SOAP Map functionality extensions that Axis2, PHP 5, and other utilize (they all, at last look, generally convert their map types into similar arrays of key-value entities).

Environment

Operating System: All Platform: All

Affected Versions

[2.0.3]

Tomas-Kraus avatar Sep 02 '06 13:09 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/234
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 14:09 Tomas-Kraus

@glassfishrobot Commented Reported by [email protected]

Tomas-Kraus avatar Sep 02 '06 13:09 Tomas-Kraus

@glassfishrobot Commented Was assigned to jaxb-issues

Tomas-Kraus avatar Sep 02 '06 13:09 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-234

Tomas-Kraus avatar Apr 24 '17 11:04 Tomas-Kraus