0

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?

Alan Evangelista
  • 2,888
  • 6
  • 35
  • 45

1 Answers1

1

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?

Community
  • 1
  • 1
fallens4e
  • 443
  • 5
  • 8