2

If you have some Java class:

@XmlType(namespace="")
@XmlRootElement(name="", namespace="")
public class Car 
{

    // This is some comment
    @XmlElement()
    private long id;
...

And you want to create schema like this (with comment inside schema):

<xs:complexType name="Car ">
  <xs:sequence>
    <xs:documentation> This is some comment</xs:documentation>
    <xs:element name="id" type="xs:long"/>
  </xs:sequence>
</xs:complexType>

Is there way how to configure JAXB? I have think, is there way how to create "new annotation", so my Java class would look like:

@XmlType(namespace="")
@XmlRootElement(name="", namespace="")
public class Car 
{

    @XmlDoc("This is some comment")
    @XmlElement()
    private long id;
...

In other words: can I tell jaxb, that new annotation is important to him and how it should be "parsed" in context.generateSchema (schemaOutputResolver)

(As example: @XmlDoc is new annotation and jaxb should take its value and put in xs: document element)

4

1 回答 1

1

注意:我是EclipseLink JAXB (MOXy)负责人,也是JAXB (JSR-222)专家组的成员。

此功能目前不存在,但之前已请求:

还有一个开放的增强请求,我们正在收集将此类功能添加到 MOXy 的要求。我很想听听你的想法:

于 2013-06-17T14:16:59.450 回答