Rename CaseNodeCodecContext
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / SchemaUnawareCodec.java
index fd4f0e9b6e1abb9971e2e54af5bacc77eb4f3b38..9c201fbdbf540262da2528c51b0badc41dce474e 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 import java.util.concurrent.ExecutionException;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
-import org.opendaylight.yangtools.concepts.AbstractIllegalArgumentCodec;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
@@ -22,7 +21,7 @@ import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
  * modules) they may have one static instance generated when first time needed.
  */
 // FIXME: IllegalArgumentCodec is perhaps not appropriate here due to null behavior
-abstract class SchemaUnawareCodec extends AbstractIllegalArgumentCodec<Object, Object> {
+abstract class SchemaUnawareCodec extends AbstractValueCodec<Object, Object> {
     /**
      * No-op Codec, Java YANG Binding uses same types as NormalizedNode model for base YANG types, representing numbers,
      * binary, strings and empty.
@@ -60,10 +59,10 @@ abstract class SchemaUnawareCodec extends AbstractIllegalArgumentCodec<Object, O
         }
 
         try {
-            if (rootType instanceof EnumTypeDefinition) {
-                return EnumerationCodec.of(typeClz, (EnumTypeDefinition) rootType);
-            } else if (rootType instanceof BitsTypeDefinition) {
-                return BitsCodec.of(typeClz, (BitsTypeDefinition) rootType);
+            if (rootType instanceof EnumTypeDefinition enumType) {
+                return EnumerationCodec.of(typeClz, enumType);
+            } else if (rootType instanceof BitsTypeDefinition bitsType) {
+                return BitsCodec.of(typeClz, bitsType);
             } else {
                 return EncapsulatedValueCodec.of(typeClz);
             }