Cleanup enumeration static factory methods 15/100815/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 26 Apr 2022 12:47:23 +0000 (14:47 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 26 Apr 2022 15:46:44 +0000 (15:46 +0000)
commitc2e78da031e0183447fd29092e9c8da45e318feb
tree7064c342fdc76758b0fd25fdbc9fb3a32169ea33
parent5ceb6e0b3c6111928f0ef9e618e15faae46c8560
Cleanup enumeration static factory methods

We have some amount of inconsistency around enumeration returns. Improve
the situation by making forName() return a nullable value and add
ofName()/ofValue() methods which throw IAE.

While we are modifying the template, also add proper @Nullable and
@NonNull annotations.

JIRA: MDSAL-754
Change-Id: I07fe4b408174ba830bcc1369ed70597ea2538a85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/EnumTemplate.xtend
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/CodeHelpers.java
binding/yang-binding/src/test/java/org/opendaylight/yangtools/yang/binding/CodeHelpersTest.java
model/ietf/rfc8294-ietf-routing-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/routing/types/rev171204/IetfRoutingUtils.java
model/ietf/rfc8519-ietf-ethertypes/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/ethertypes/rev190304/EthertypeUtils.java