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 (将#修改为@)