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

Decorator for @Nullable annotations #7

Open
bjansen opened this issue Apr 25, 2020 · 0 comments
Open

Decorator for @Nullable annotations #7

bjansen opened this issue Apr 25, 2020 · 0 comments

Comments

@bjansen
Copy link

bjansen commented Apr 25, 2020

Hi,

I was wondering if you would consider adding a new decorator to the codegen that adds a @Nullable annotation on getters that might return a null value, based on the cardinality defined in the XSD.

For example,

<xs:element name="Foo" type="xs:string" minOccurs="0"/>

would generate the following getter:

@javax.annotation.Nullable
public String getFoo() { }

Also, things like choices would also result in nullable getters:

<xs:sequence>
    <xs:choice>
        <xs:element name="foo" type="xs:string"/>
        <xs:element name="bar" type="xs:string"/>
    </xs:choice>
</xs:sequence>

would result in:

@javax.annotation.Nullable
public String getFoo() { }

@javax.annotation.Nullable
public String getBar() { }

I started working on such a decorator, I think I have something that works pretty well on my XSD but I'm not sure it's 100% correct, and I would rather use an officiel decorator that is bundled with JiBX.

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