@Override public <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(final Class<H> caseType, final Class<C> childType) { return streamModifiedChildren(childType) .filter(child -> caseType.equals(child.identifier.getCaseType().orElse(null))) .collect(Collectors.toList()); }
@Override public final int compareTo(final PathArgument arg) { final int cmp = compareClasses(type, arg.getType()); if (cmp != 0) { return cmp; } final Optional<? extends Class<?>> caseType = getCaseType(); if (!caseType.isPresent()) { return arg.getCaseType().isPresent() ? -1 : 1; } final Optional<? extends Class<?>> argCaseType = getCaseType(); return argCaseType.isPresent() ? compareClasses(caseType.get(), argCaseType.get()) : 1; }
@Override public DataContainerCodecContext<?, ?> bindingPathArgumentChild(final InstanceIdentifier.PathArgument arg, final List<PathArgument> builder) { final Optional<? extends Class<? extends DataObject>> caseType = arg.getCaseType(); if (caseType.isPresent()) { // XXX: we use two caseType.get()s because of https://bugs.openjdk.java.net/browse/JDK-8144185, // which makes JaCoCo blow up if we try using @NonNull on the local variable. final ChoiceNodeCodecContext<?> choice = choicesByClass.getUnchecked(caseType.get()); choice.addYangPathArgument(arg, builder); final DataContainerCodecContext<?, ?> caze = choice.streamChild(caseType.get()); caze.addYangPathArgument(arg, builder); return caze.bindingPathArgumentChild(arg, builder); } return super.bindingPathArgumentChild(arg, builder); }
@Override public DataContainerCodecContext<?,?> bindingPathArgumentChild(final InstanceIdentifier.PathArgument arg, final List<YangInstanceIdentifier.PathArgument> builder) { final Class<? extends DataObject> argType = arg.getType(); DataContainerCodecPrototype<?> ctxProto = byBindingArgClass.get(argType); if (ctxProto == null && Augmentation.class.isAssignableFrom(argType)) { ctxProto = augmentationByClass(argType); } final DataContainerCodecContext<?, ?> context = childNonNull(ctxProto, argType, "Class %s is not valid child of %s", argType, getBindingClass()).get(); if (context instanceof ChoiceNodeCodecContext) { final ChoiceNodeCodecContext<?> choice = (ChoiceNodeCodecContext<?>) context; choice.addYangPathArgument(arg, builder); final Optional<? extends Class<? extends DataObject>> caseType = arg.getCaseType(); final Class<? extends DataObject> type = arg.getType(); final DataContainerCodecContext<?, ?> caze; if (caseType.isPresent()) { // Non-ambiguous addressing this should not pose any problems caze = choice.streamChild(caseType.get()); } else { caze = choice.getCaseByChildClass(type); } caze.addYangPathArgument(arg, builder); return caze.bindingPathArgumentChild(arg, builder); } context.addYangPathArgument(arg, builder); return context; }