Add a link to this resource

@param rel
@param href The target href for the link, relative to the href of this resource.
504426
public static void withLink(Representation representation, String rel, String href, Optional<Predicate<ReadableRepresentation>> predicate, Optional<String> name, Optional<String> title, Optional<String> hreflang, Optional<String> profile) {
        if (predicate.or(Predicates.<ReadableRepresentation>alwaysTrue()).apply(representation)) {
            representation.withLink(rel, href, name.orNull(), title.orNull(), hreflang.orNull(), profile.orNull());
        }
    }
1054855
function makeLink(rel, ldo) {
  var i, key, keys, result;

  if (typeof ldo === 'string') {
    return '<' + ldo + '>; rel="' + rel + '"';
  }

  result = '<' + ldo.href + '>; rel="' + rel + '"';
  keys = Object.keys(ldo);

  for (i = 0; i < keys.length; i += 1) {
    key = keys[i];

    if (key !== 'href' && key !== 'rel') {
      result += '; ' + key + '="' + ldo[key] + '"';
    }
  }

  return result;
}
942115
protected void addAllClassesLink(Content ul) {
        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
                allclassesLabel, "", "packageFrame");
        Content li = HtmlTree.LI(linkContent);
        ul.addContent(li);
    }
197388
public function addLink($key, $href, array $meta=[]) {
		$this->ensureLinksObject();
		$this->links->add($key, $href, $meta);
	}
1144994
public void addLinkRef(final String key, final LinkRef linkRef)
    {
        this.linkRefs.put(key.toLowerCase(), linkRef);
    }
1313089
def link_add(self, rel, href, **atts):
        
        self.link_set(rel, href, allow_duplicates=True, **atts)
358735
protected HalRepresentation add(final Links links) {
        this.links = this.links != null
                ? copyOf(this.links).with(links).build()
                : links.using(this.curies);
        if (embedded != null) {
            embedded = embedded.using(this.curies);
        }
        return this;
    }
1284448
public function prepend($href, $rel = null, $type = null, $media = null)
    {
        self::$linkList->prepend(array($href, $rel, $type, $media));
        return $this;
    }
895364
function createLink(link) {
        var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK),
            left = link.bbox[0],
            top = link.bbox[1],
            attr = {};

        if (browser.ie) {
            // @NOTE: IE doesn't allow override of ctrl+click on anchor tags,
            // but there is a workaround to add a child element (which triggers
            // the onclick event first)
            $('<span>')
                .appendTo($link)
                .on('click', handleClick);
        }

        $link.css({
            left: left + 'pt',
            top: top + 'pt',
            width: link.bbox[2] - left + 'pt',
            height: link.bbox[3] - top + 'pt'
        });

        if (link.uri) {
            if (/^http|^mailto/.test(link.uri)) {
                attr.href = encodeURI(link.uri);
                attr.target = '_blank';
                attr.rel = 'noreferrer'; // strip referrer for privacy
            } else {
                // don't embed this link... we don't trust the protocol
                return;
            }
        } else if (link.destination) {
            attr.href = '#page-' + link.destination.pagenum;
        }

        $link.attr(attr);
        $link.data('link', link);
        $link.appendTo($el);
    }
738942
public function addOneLink($rel, $href, $type = '', $attr = array(), $cond = '')
	{
		$this->addLink(array(array($rel, $href, $type, $attr, $cond)));
	}
1210833
public function addLink(
        $linkOrRel,
        string $href = null,
        $classes = [],
        string $title = null,
        string $type = null
    ) : self {
        $link = $linkOrRel;

        if (!$linkOrRel instanceof Link) {
            $rels    = is_array($linkOrRel) ? $linkOrRel : [$linkOrRel];
            $classes = is_array($classes) ? $classes : [$classes];
            $link    = new Link($rels, $href, $classes, $title, $type);
        }

        $this->links[] = $link;

        return $this;
    }
253212
public function setSelfLink($href, array $meta=[], $level=Document::LEVEL_ROOT) {
		$this->addLink('self', $href, $meta, $level);
	}
507841
public void setHref(String url) {
        if (url == null)
            throw new RuntimeException("Cannot set URL to null. Call removeUrl() if you wanted to remove the URL");
        if (anchor == null) {
            if (controlGroupRoot != null) {
                //!!! following code is semi-working, it's not reconstructed item correctly
                remove(controlGroupRoot);
                anchor = Document.get().createAnchorElement();
                anchor.setAttribute("href", url);
                moveThisChildrenToAnchor();
                cleanUpLI();
                prepareAnchorForControlGroup();
                getElement().appendChild(anchor);
                checkAnchorPanel();
            } else {
                // need to make anchor and move children to it
                anchor = Document.get().createAnchorElement();
                moveThisChildrenToAnchor();
                getElement().appendChild(anchor);
            }
            addItemActivationHandlers();
        }
        anchor.setAttribute("href", url);
    }
747033
public HalResource setLink(String relation, Link link) {
    if (link == null) {
      return this;
    }
    return addResources(HalResourceType.LINKS, relation, false, new Link[] {
        link
    });
  }
539745
public static Link getLinkByRel(Entity entity, String... rel) {
        if(entity == null) {
            throw new IllegalArgumentException("entity cannot be null.");
        }
        if(ArrayUtils.isEmpty(rel)) {
            throw new IllegalArgumentException("rel cannot be null or empty");
        }
        List<Link> links = entity.getLinks();
        if (links == null)
            return null;
        Link link = null;
        for (Link l : links) {
            if (ArrayUtils.isNotEmpty(l.getRel()) && ArrayUtils.toString(rel).equals(ArrayUtils.toString(l.getRel()))) {
                link = l;
                break;
            }
        }
        return link;
    }
639095
public function setHref($href)
    {
        if (gettype($href) === 'string') {
            $this->href = $href;
        } else {
            $msg = "href must be a string, '" . gettype($href) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1230974
public Optional<Link> getLinkByRel(final String rel)
    {
        return Optional.ofNullable(representation.getLinkByRel(rel));
    }