Schemagen.exe does not pass @XmlTransient annotated class

I annotated the XmlAdapter class like this:

@XmlTransient
public class DateTimeXmlAdapter extends XmlAdapter<String, DateTime> {

      

but schemagen.exe generates

<xs:complexType name="xmlAdapter" abstract="true">
    <xs:sequence/>
  </xs:complexType>

      

so it doesn't skip the class, which is what I expected. The XmlAdapter is indeed the abstract class that my transient class inherits from. What should I do?

The reason I am referencing in the DateTimeXmlAdapter field is:

@XmlElement(name="StartDatetime")
@XmlJavaTypeAdapter(DateTimeXmlAdapter.class)
protected DateTime startDatetime;

      

which I think is correct.

+2


source to share


1 answer


It looks like you said to schemagen

generate schema types for everything in your java package including the subclass XmlAdapter

. Therefore it sees your adapter class being marked as @XmlTransient

and therefore does not create a schema type for it. However, it generates the schema type itself for XmlAdapter

.



You need to change the way it is called schemagen

so that your adapter class is excluded from code generation. @XmlTransient

doesn't fit here, so remove that from the adapter class.

+1


source







All Articles