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;
* 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.
}
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);
}