wasedaxiao wrote:how would that be useful? since you don't generate the class until runtime, you can't really write any code to use the classes. so, what would be the point?
Yes, I mean it at runtime.
Like JAXBContext..generateSchema() that can generate XSD(XML Schema) from Java class at runtime, but I could not find such a similar API that can generate Java class from XSD.
wasedaxiao wrote:What's the usage scenario that allows for 'dynamic' changes in the XSD?
The tool xjc can generate Java class manually. Why there is no such API to do that programmatically?
For example, someone needs to generate Java files from xsd files periodically that are updated sometimes. You can write a Java program to do that.
wasedaxiao wrote:When you get a pojo with properties specified in an XSD then you generally want to be using that pojo's properties in your code. If the XSD that specs the pojo is changed, the code that uses the pojo usually has to change as well to start using the new properties or to stop using the now removed properties. In this case changing the XSD is always going to require other code changes anyway. Even if you do get the new class files, you now need to unload the previous versions of the pojo and somehow load the new version of the pojo.
For now I don't have such a scenario that updates xsd files dynamically.
Based on your questions, I suspect there is no such use case for generating Java file programmatically, that is why there is no such API provided, right?