eclipse-ee4j / jaxb-ri

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

Let XmlJavaTypeAdapter apply to direct marshalling #586

Open Tomas-Kraus opened 15 years ago

Tomas-Kraus commented 15 years ago

Background information is: http://weblogs.java.net/blog/kohsuke/archive/2005/09/using_jaxb_20s.html

If you try to use the XmlJavaTypeAdapter described for a class C, it seems to only work when you are marshalling a parent class P that has C as a child property. But I want to see the ability to define an XmlJavaTypeAdapter for class C, and then when marshalling C, the adapter is used.

(I thought this would work, but it does not. If it is supposed to, then this is not an Enhancement request, but a Bug report.)

Fundamentally, we need the ability to define marshalling for final classes, or third party classes where you have no capability to add an @XmlRootElement annotation. Since JAXB is baked into JAX-WS and JAX-RS, this limitation poses serious issues with Web Service development.

I have posted questions here: http://forums.sun.com/thread.jspa?threadID=5358578&tstart=15 and here: http://forums.java.net/jive/thread.jspa?threadID=55517&tstart=30

I have since tried a simpler example... Create class C, and just call JAXB.marshal(c, System.out); The class is marhsalled, but it does NOT use my defined Adapter (I declared it at the package level, like Kohsuke Kawaguchi's blog entry).

Environment

Operating System: All Platform: All URL: http://forums.java.net/jive/thread.jspa?threadID=55517&tstart=30

Affected Versions

[2.1.8]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 15 years ago

@glassfishrobot Commented Reported by whitfordny@java.net

Tomas-Kraus commented 14 years ago

@glassfishrobot Commented vladfi2 said: This issue is a defect. The JAXB documentation clearly states that this is acceptable usage of @XmlJavaTypeAdapter.

Also, see issue 605.

Tomas-Kraus commented 14 years ago

@glassfishrobot Commented vladfi2 said: Changed issue status to defect.

Tomas-Kraus commented 15 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

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