I have the following problem. For webservices I am using an existing data model. So I need to apply JAXB annotations on the existing source classes. This requires a lot of effort to do manually.
Does anyone know a tool that can help automate this process? For clarity, generating java source code through an xsd
is not the goal.
You can first get all classes in your data model package and then use Javassist to do add an annotation on each of those classes at run-time.
If you want to avoid this procedure though and just change the source code I think Search/Replace in your data model package would be the way to go.
JAXB (JSR-222) is configuration by exception. This means you only need to annotate the model where the desired representation defers from the default one:
If you have an XML Schema that you are trying to map your domain model to, then you may find the Dali JAXB tooling in Eclipse helpful. I would recommend trying out a pre-released version of Juno.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.