- if (context instanceof ChoiceCodecContext<?> choice) {
- choice.addYangPathArgument(arg, builder);
-
- final var caseType = arg.getCaseType();
- final var type = arg.getType();
- final DataContainerCodecContext<?, ?> caze;
- if (caseType.isPresent()) {
- // Non-ambiguous addressing this should not pose any problems
- caze = choice.getStreamChild(caseType.orElseThrow());
- } else {
- caze = choice.getCaseByChildClass(type);
- }
-
- caze.addYangPathArgument(arg, builder);
- return caze.bindingPathArgumentChild(arg, builder);
+ context.addYangPathArgument(step, builder);
+ if (context instanceof CommonDataObjectCodecContext<?, ?> dataObject) {
+ return dataObject;
+ } else if (context instanceof ChoiceCodecContext<?> choice) {
+ return choice.bindingPathArgumentChild(step, builder);
+ } else {
+ throw new IllegalStateException("Unhandled context " + context);