private NotificationCodecContext<?> createNotificationDataContext(final Class<?> notificationType) { Preconditions.checkArgument(Notification.class.isAssignableFrom(notificationType)); Preconditions.checkArgument(notificationType.isInterface(), "Supplied class must be interface."); final QName qname = BindingReflections.findQName(notificationType); /** * FIXME: After Lithium cleanup of yang-model-api, use direct call on schema context to retrieve * notification via index. */ final NotificationDefinition schema = SchemaContextUtil.getNotificationSchema(getSchema(), SchemaPath.create(true, qname)); Preconditions.checkArgument(schema != null, "Supplied %s is not valid notification", notificationType); return new NotificationCodecContext<>(notificationType, schema, factory()); }
NotificationCodecContext<?> createNotificationDataContext(final Class<?> notificationType) { checkArgument(Notification.class.isAssignableFrom(notificationType)); checkArgument(notificationType.isInterface(), "Supplied class must be interface."); final QName qname = BindingReflections.findQName(notificationType); /** * FIXME: After Lithium cleanup of yang-model-api, use direct call on schema context * to retrieve notification via index. */ final NotificationDefinition schema = SchemaContextUtil.getNotificationSchema(getSchema(), SchemaPath.create(true, qname)); checkArgument(schema != null, "Supplied %s is not valid notification", notificationType); return new NotificationCodecContext<>(notificationType, schema, factory()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public NotificationCodecContext load(final SchemaPath key) throws Exception { final NotificationDefinition schema = SchemaContextUtil.getNotificationSchema(getSchema(), key); final Class clz = factory().getRuntimeContext().getClassForSchema(schema); return getNotification(clz); } });
@Override public NotificationCodecContext<?> load(final SchemaPath key) { final NotificationDefinition schema = SchemaContextUtil.getNotificationSchema(getSchema(), key); @SuppressWarnings("unchecked") final Class<? extends Notification> clz = (Class<? extends Notification>) factory().getRuntimeContext().getClassForSchema(schema); return getNotification(clz); } });