code: @Programmatic
      public NotableLink createLink(
              final Note note,
              final Object notable) {
  
          final Class<? extends NotableLink> subtype = subtypeClassFor(notable);
  
          final NotableLink link = repositoryService.instantiate(subtype);
  
          link.setNote(note);
  
          final Bookmark bookmark = bookmarkService.bookmarkFor(notable);
          link.setNotable(notable);
          link.setNotableStr(bookmark.toString());
  
          repositoryService.persistAndFlush(link);
  
          return link;
      }
docs: region > createLink (programmatic)