微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jaxb2-annotate-plugin 不能注释匿名类

如何解决jaxb2-annotate-plugin 不能注释匿名类

我似乎无法让 xjc 注释匿名类。这是我的自定义注释的样子

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD,ElementType.TYPE})
public @interface MyCustomAnnotation{
    String value() default "";
}

具有匿名类的元素如下

<xs:element name="myElement" minOccurs="0">
    <xs:complexType>
        <xs:annotation>
            <xs:appinfo>
                <annox:annotate  type="com.organization.MyCustomAnnotation" target="field" value="Brief description."></annox:annotate>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="fieldA" type="xs:double">
                <xs:annotation>
                    <xs:appinfo>
                        <annox:annotate  type="com.organization.MyCustomAnnotation" target="field" value="FieldA description."></annox:annotate>
                     </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:element name="fieldB" type="xs:int">
                <xs:annotation>
                    <xs:appinfo>
                        <annox:annotate  type="com.organization.MyCustomAnnotation" target="field" value="FieldB description."></annox:annotate>
                     </xs:appinfo>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

我希望使用自定义注释对生成字段进行注释

@MyCustomAnnotation("Brief description")
protected MainClass.MyElement myElement;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。