我似乎无法让 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;