Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibilty to find a fix for fixedValues in ComplexType restriction #166

Open
AndreasIgelCC opened this issue Feb 10, 2023 · 0 comments
Open

Comments

@AndreasIgelCC
Copy link

AndreasIgelCC commented Feb 10, 2023

Hi at all,

first, thank you for all your work and this plugin here!

Currently we have the problem in handling that (commonly known) problem with generated Java-Code on Types which restricts a complex type by fixed values. Example:

	<xs:complexType name="complexTypeWithSequence">
		<xs:sequence>
			<xs:element name="a" type="xs:string"/>
			<xs:element name="b" type="xs:long"/>
		</xs:sequence>
                <xs:attribute name="attributeA" type="xs:string" use="optional"/>
	</xs:complexType>
	<xs:complexType name="complexTypeWithSequenceAndConst">
		<xs:complexContent>
		    <xs:restriction base="complexTypeWithSequence">
                        <xs:attribute name="attributeA" type="xs:string" use="optional" fixed="exampleConstantValue"/>
		    </xs:extension>
		</xs:complexContent>
	</xs:complexType>

The generation would create 2 classes: ComplexTypeWithSequence and ComplexTypeWithSequenceAndConst. ComplexTypeWithSequenceAndConst would inherit from ComplexTypeWithSequence, but no getters/setters are generated and the fixed value is totally lost. Same happens when using default instead of fixed. Of course this could be solved by using the globalBinding-option "xjc:treatRestrictionLikeNewType" in jxb-bindings-file But by that all inheritence is lost, even where it is generated correctly.

From my point of view a solution would be best, which has a look on the generated java class and injects an override to the existing parent-class if there is a restriction with default value. But could that kind of problem be solved with a jaxb2-basics-plugin here or does even the idea for solution leads to the correct direction? And if that is the case, could you give a hint how to solve that best?

Best regards,
Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant