Is there's a way to have extra methods in an class generated with JAXB ... To be more specific I would like make changes in my .xsd files and not code some methods in a "first.java" class and then make my .xsd generated classes inherit from "first.java" .. My goal is to modify only my .jaxb file .. so can we create methods with .xsd ?
I have an ".xsd" file that generates a class. And I want to know if it's possible to add to this generated class some other methods besides the getters and setters. I search around tutorials and some StackOverflow topics but I didn't find instructions on how can I add custom methods to a generated class described on XML Schema.
Here's my .xsd file :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1">
<xs:element name="Myclass" />
<xs:complexType name="Myclass">
<xs:complexContent>
</xs:complexContent>
</xs:complexType>
</xs:schema>
And here's the class generated with this .xsd file :
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Myclass")
public class Myclass
{
}
Here's an example of a class that I want to generate with
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Myclass")
public class Myclass
{
public String method(){
return "Hello";
}
}
Thank's in advance :)