+ }
+
+ // keep spotbugs from complaining about overridable method in constructor
+ public static CurrentSchemaContext create(final DOMSchemaService schemaService,
+ final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider) {
+ var context = new CurrentSchemaContext(rootSchemaSourceProvider);
+ final Registration registration = schemaService.registerSchemaContextListener(context);
+ context.setRegistration(registration);
+ return context;
+ }
+
+ private void setRegistration(final Registration registration) {
+ schemaContextListenerListenerRegistration = registration;
+ }
+
+ public @NonNull EffectiveModelContext getCurrentContext() {
+ final var ret = currentContext.get();
+ checkState(ret != null, "Current context not received");
+ return ret;