tags:

views:

250

answers:

1

I want my classes generated from XSD schema by XJC to be annotated with custom annotations (actually specifying class name).

For example, from the following XSD schema

<xs:complexType name="Unit">
    <xs:attribute name="Id" type="xs:string" use="required"/>
</xs:complexType>

XJC generates:

@XmlType(name = "Unit")
public class Unit {
    @XmlAttribute(name = "Id", required = true)
    protected String id;
}

Is there a way to modify an schema so the custom annotation will be generated by XJC at the class level, like following:

@XmlType(name = "Unit")
@ProcessorClass(Processor.class)
public class Unit {
    @XmlAttribute(name = "Id", required = true)
    protected String id;
}

Or, at least

@XmlType(name = "Unit")
@ProcessorClassName("my.processors.Processor")
public class Unit {
    @XmlAttribute(name = "Id", required = true)
    protected String id;
}

Thanks, Boris

A: 

Did you ever figure out how to do this? I want to do the exact same thing

Jay