javaee / jaxb-v2

Other
210 stars 100 forks source link

XmlIDREF to interface #448

Open glassfishrobot opened 16 years ago

glassfishrobot commented 16 years ago

JAXB doesn't support a 'code-to-interfaces' approach when it comes to id references (i.e. @XmlIDREF), because a property on a class annotated with @XmlIDREF and @XmlAttribute can only refer to a class, but not an interface. The following does not work:

@XmlIDREF @XmlAttribute public MyInterface getMyInterface() { //this is an interface return myInterface; }

What's needed is an equivalent to @XmlElementRef (e.g. @XmlAttributeRef) for attributes, that lets you specify the allowable classes of the interface of the property.

Perhaps some kind of autodetection could be possible, by looking up the single element in the XML file with an ID specified by the above property, and seeing if it's assignable to a type of 'MyInterface'.

Environment

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

Affected Versions

[2.1.4]

glassfishrobot commented 16 years ago

Reported by vk101

glassfishrobot commented 16 years ago

Was assigned to snajper

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAXB-448