Cleanup ObjectCodec a bit 06/97206/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 13 Aug 2021 19:33:58 +0000 (21:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 13 Aug 2021 19:49:47 +0000 (21:49 +0200)
Use a return expression and do not use the useless this.obviously
field references.

Change-Id: I2144d8e855ff56269118df505c43741bb292e282
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java

index d455e813f15c198faf8af5b187914388092e0401..3e276c42464568f98e3072508921294f46e91969 100644 (file)
@@ -102,9 +102,9 @@ public final class RestCodec {
         @Override
         public Object deserialize(final Object input) {
             try {
-                if (this.type instanceof IdentityrefTypeDefinition) {
+                if (type instanceof IdentityrefTypeDefinition) {
                     if (input instanceof IdentityValuesDTO) {
-                        return this.identityrefCodec.deserialize(input);
+                        return identityrefCodec.deserialize(input);
                     }
                     if (LOG.isDebugEnabled()) {
                         LOG.debug(
@@ -113,14 +113,9 @@ public final class RestCodec {
                             input == null ? "null" : input.getClass(), String.valueOf(input));
                     }
                     return null;
-                } else if (this.type instanceof InstanceIdentifierTypeDefinition) {
-                    if (input instanceof IdentityValuesDTO) {
-                        return this.instanceIdentifier.deserialize(input);
-                    } else {
-                        final StringModuleInstanceIdentifierCodec codec =
-                                new StringModuleInstanceIdentifierCodec(schemaContext);
-                        return codec.deserialize((String) input);
-                    }
+                } else if (type instanceof InstanceIdentifierTypeDefinition) {
+                    return input instanceof IdentityValuesDTO ? instanceIdentifier.deserialize(input)
+                        : new StringModuleInstanceIdentifierCodec(schemaContext).deserialize((String) input);
                 } else {
                     final TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> typeAwarecodec =
                             TypeDefinitionAwareCodec.from(this.type);