Reputation: 3163
I have a Java class which is auto-generated from a xml schema file using JIBX. I'd like to have a default value for a class attribute. I have set the default attribute value in the xsd, but I do not see any changes in Java class source code when I regenerate it. I'd expect to see a default constructor which sets default values or attribute initialization in its definition, but I don't see either. Maybe JIBX will embed this code in class bytecode optimization? The issue is that I also use the class in my code and, when I try to manually create it, the default value is not set.
Am I doing something wrong or JIBX was not meant to work like this?
Upvotes: 0
Views: 419
Reputation: 513
It seems there are no options you can pass to org.jibx.schema.codegen.CodeGen to fix that problem
File binding.xml supposed to be maintained manually so as a workaround you can add "default" attribute to you value "tag" like in the following question: How to set a default value when a field is null in jibx binding?
Upvotes: 1