eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
204 stars 111 forks source link

Natural JAXB support for interfaces #447

Open Tomas-Kraus opened 16 years ago

Tomas-Kraus commented 16 years ago

I would like JAXB to support interfaces natively without workarounds or XmlAdapters. Though I am not familiar with the spec, it seems like JAXB should follow the following procedure when unmarshalling a class:

1. Unmarshall using Class.newInstance(). 2. If #1 won't work, search for the factoryClass and factoryMethod attributes of the XmlType annotation and use those to generate the object. 3. If #1 and #2 won't work, search for the ObjectFactory for this package and find a method returning the desired type. 4. If all 3 steps fail, report an error.

This feature would make JAXB easier to learn and easier to use. If this is in conflict with the spec, I would request that this be added as a vendor-specific feature.

Environment

Operating System: All Platform: All

Affected Versions

[2.1.5]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 16 years ago

@glassfishrobot Commented Reported by tigera

Tomas-Kraus commented 16 years ago

@glassfishrobot Commented Was assigned to jaxb-issues

Tomas-Kraus commented 7 years ago

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