+ public BindingCodecTree create(final SchemaContext context, final Class<?>... bindingClasses) {
+ return this.codecRegistry.create(context, bindingClasses);
+ }
+
+ @Nonnull
+ protected Map.Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> getSubtreeCodec(
+ final YangInstanceIdentifier domIdentifier) {
+
+ final BindingCodecTree currentCodecTree = this.codecRegistry.getCodecContext();
+ final InstanceIdentifier<?> bindingPath = this.codecRegistry.fromYangInstanceIdentifier(domIdentifier);
+ Preconditions.checkArgument(bindingPath != null);
+ /**
+ * If we are able to deserialize YANG instance identifier, getSubtreeCodec must
+ * return non-null value.
+ */
+ final BindingCodecTreeNode<?> codecContext = currentCodecTree.getSubtreeCodec(bindingPath);
+ return new SimpleEntry<>(bindingPath, codecContext);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<Class<? extends Notification>> getNotificationClasses(final Set<SchemaPath> interested) {
+ final Set<Class<? extends Notification>> result = new HashSet<>();
+ final Set<NotificationDefinition> knownNotifications = runtimeContext().getSchemaContext().getNotifications();
+ for (final NotificationDefinition notification : knownNotifications) {
+ if (interested.contains(notification.getPath())) {
+ try {
+ result.add((Class<? extends Notification>) runtimeContext().getClassForSchema(notification));
+ } catch (final IllegalStateException e) {
+ // Ignore
+ LOG.warn("Class for {} is currently not known.",notification.getPath(),e);
+ }
+ }
+ }
+ return result;
+ }
+
+ private static Collection<Class<?>> decompose(final InstanceIdentifier<?> path) {
+ final Set<Class<?>> clazzes = new HashSet<>();
+ for(final InstanceIdentifier.PathArgument arg : path.getPathArguments()) {
+ clazzes.add(arg.getType());
+ }
+ return clazzes;