Skip to content

Decorator for @Nullable annotations #7

@bjansen

Description

@bjansen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions