+ private final LoadingCache<Class<?>, NotificationCodecContext<?>> notificationsByClass = CacheBuilder.newBuilder()
+ .build(new CacheLoader<Class<?>, NotificationCodecContext<?>>() {
+ @Override
+ public NotificationCodecContext<?> load(final Class<?> key) {
+ checkArgument(key.isInterface(), "Supplied class must be interface.");
+ final QName qname = BindingReflections.findQName(key);
+ final NotificationDefinition schema = getSchema().findNotification(qname).orElseThrow(
+ () -> new IllegalArgumentException("Supplied " + key + " is not valid notification"));
+ return new NotificationCodecContext<>(key, schema, factory());
+ }
+ });
+