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?

4

1 に答える 1

1

その問題を解決するために org.jibx.schema.codegen.CodeGen に渡すことができるオプションはないようです

次の質問のように、回避策として値「タグ」に「デフォルト」属性を追加できるように、ファイル binding.xml は手動で維持する必要があります: How to set a default value when a field is null in jibx binding?

于 2014-03-21T13:09:03.943 に答える