Cleanup StringModuleInstanceIdentifierCodec a bit 29/97229/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 13 Aug 2021 19:25:23 +0000 (21:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Aug 2021 09:47:48 +0000 (11:47 +0200)
commitc674a6bbd1105fb58c0fa779781499fda20d4fd9
tree9afff3ef98dd645a94c7129a3cdfebfdcd4f1c97
parentb8dbe0608273ebddb12844c836989e5fb7855c4a
Cleanup StringModuleInstanceIdentifierCodec a bit

Compact the implementation a bit by reusing code paths. Also we do not
really allow null defaultPrefix, but check for it being empty.

Make this.defaultPrefix nullable, which allows us to simplify the check
in moduleForPrefix() down to a simple null check.

JIRA: NETCONF-804
Change-Id: Ifa01017613761466a32e371d56b0bb6521145115
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 63eba7f355bacfe2aa1f20112cf2a7f98bd2928c)
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/StringModuleInstanceIdentifierCodec.java