public ResolvedLink withLinkType(LinkType linkType) { return linkType == this.myLinkType ? this : new ResolvedLink(linkType, myUrl, myAttributes, myStatus); } public ResolvedLink withStatus(LinkStatus status) { return status == this.myStatus ? this : new ResolvedLink(myLinkType, myUrl, myAttributes, status); }
public ResolvedLink withStatus(LinkStatus status) { return status == this.myStatus ? this : new ResolvedLink(myLinkType, myUrl, myAttributes, status); } // @formatter:on
public ResolvedLink withUrl(CharSequence url) { String useUrl = String.valueOf(url); return this.myUrl.equals(useUrl) ? this : new ResolvedLink(myLinkType, useUrl, myAttributes, myStatus); }
return new ResolvedLink(LinkType.IMAGE, sb.toString(), null, LinkStatus.UNCHECKED); } else { return new ResolvedLink(LinkType.LINK, sb.toString(), null, LinkStatus.UNCHECKED);
@Override public ResolvedLink resolveLink(LinkType linkType, CharSequence url, Attributes attributes, Boolean urlEncode) { HashMap<String, ResolvedLink> resolvedLinks = resolvedLinkMap.get(linkType); if (resolvedLinks == null) { resolvedLinks = new HashMap<String, ResolvedLink>(); resolvedLinkMap.put(linkType, resolvedLinks); } String urlSeq = String.valueOf(url); ResolvedLink resolvedLink = resolvedLinks.get(urlSeq); if (resolvedLink == null) { resolvedLink = new ResolvedLink(linkType, urlSeq, attributes); if (!urlSeq.isEmpty()) { Node currentNode = renderingNode; for (LinkResolver linkResolver : myLinkResolvers) { resolvedLink = linkResolver.resolveLink(currentNode, this, resolvedLink); if (resolvedLink.getStatus() != LinkStatus.UNKNOWN) break; } if (urlEncode == null && rendererOptions.percentEncodeUrls || urlEncode != null && urlEncode) { resolvedLink = resolvedLink.withUrl(Escaping.percentEncodeUrl(resolvedLink.getUrl())); } } // put it in the map resolvedLinks.put(urlSeq, resolvedLink); } return resolvedLink; }
@Override public ResolvedLink resolveLink(LinkType linkType, CharSequence url, Attributes attributes, Boolean urlEncode) { HashMap<String, ResolvedLink> resolvedLinks = resolvedLinkMap.get(linkType); if (resolvedLinks == null) { resolvedLinks = new HashMap<String, ResolvedLink>(); resolvedLinkMap.put(linkType, resolvedLinks); } String urlSeq = String.valueOf(url); ResolvedLink resolvedLink = resolvedLinks.get(urlSeq); if (resolvedLink == null) { resolvedLink = new ResolvedLink(linkType, urlSeq, attributes); if (!urlSeq.isEmpty()) { Node currentNode = getCurrentNode(); for (LinkResolver linkResolver : myLinkResolvers) { resolvedLink = linkResolver.resolveLink(currentNode, this, resolvedLink); if (resolvedLink.getStatus() != LinkStatus.UNKNOWN) break; } if (urlEncode == null && htmlOptions.percentEncodeUrls || urlEncode != null && urlEncode) { resolvedLink = resolvedLink.withUrl(Escaping.percentEncodeUrl(resolvedLink.getUrl())); } } // put it in the map resolvedLinks.put(urlSeq, resolvedLink); } return resolvedLink; }
public ResolvedLink withTitle(CharSequence title) { String haveTitle = myAttributes == null ? null : myAttributes.getValue(Attribute.TITLE_ATTR); if (title == haveTitle || haveTitle != null && haveTitle.equals(title)) return this; Attributes attributes = new Attributes(myAttributes); if (title == null) { attributes.remove(Attribute.TITLE_ATTR); if (attributes.isEmpty()) attributes = null; } else { attributes.replaceValue(Attribute.TITLE_ATTR, title); } return new ResolvedLink(myLinkType, myUrl, attributes, myStatus); }
public ResolvedLink withTarget(CharSequence target) { String haveTarget = myAttributes == null ? null : myAttributes.getValue(Attribute.TARGET_ATTR); if (target == haveTarget || haveTarget != null && haveTarget.equals(target)) return this; Attributes attributes = new Attributes(myAttributes); if (target == null) { attributes.remove(Attribute.TARGET_ATTR); if (attributes.isEmpty()) attributes = null; } else { attributes.replaceValue(Attribute.TARGET_ATTR, target); } return new ResolvedLink(myLinkType, myUrl, attributes, myStatus); }
public ResolvedLink withStatus(LinkStatus status) { return status == this.myStatus ? this : new ResolvedLink(myLinkType, myUrl, myAttributes, status); } // @formatter:on
public ResolvedLink withLinkType(LinkType linkType) { return linkType == this.myLinkType ? this : new ResolvedLink(linkType, myUrl, myAttributes, myStatus); } public ResolvedLink withStatus(LinkStatus status) { return status == this.myStatus ? this : new ResolvedLink(myLinkType, myUrl, myAttributes, status); }
public ResolvedLink withUrl(CharSequence url) { String useUrl = String.valueOf(url); return this.myUrl.equals(useUrl) ? this : new ResolvedLink(myLinkType, useUrl, myAttributes, myStatus); }
@Override public ResolvedLink resolveLink(LinkType linkType, CharSequence url, Attributes attributes, Boolean urlEncode) { HashMap<String, ResolvedLink> resolvedLinks = resolvedLinkMap.get(linkType); if (resolvedLinks == null) { resolvedLinks = new HashMap<String, ResolvedLink>(); resolvedLinkMap.put(linkType, resolvedLinks); } String urlSeq = String.valueOf(url); ResolvedLink resolvedLink = resolvedLinks.get(urlSeq); if (resolvedLink == null) { resolvedLink = new ResolvedLink(linkType, urlSeq, attributes); if (!urlSeq.isEmpty()) { Node currentNode = getCurrentNode(); for (LinkResolver linkResolver : myLinkResolvers) { resolvedLink = linkResolver.resolveLink(currentNode, this, resolvedLink); if (resolvedLink.getStatus() != LinkStatus.UNKNOWN) break; } if (urlEncode == null && htmlOptions.percentEncodeUrls || urlEncode != null && urlEncode) { resolvedLink = resolvedLink.withUrl(Escaping.percentEncodeUrl(resolvedLink.getUrl())); } } // put it in the map resolvedLinks.put(urlSeq, resolvedLink); } return resolvedLink; }
public ResolvedLink withTitle(CharSequence title) { String haveTitle = myAttributes == null ? null : myAttributes.getValue(Attribute.TITLE_ATTR); if (title == haveTitle || haveTitle != null && haveTitle.equals(title)) return this; Attributes attributes = new Attributes(myAttributes); if (title == null) { attributes.remove(Attribute.TITLE_ATTR); if (attributes.isEmpty()) attributes = null; } else { attributes.replaceValue(Attribute.TITLE_ATTR, title); } return new ResolvedLink(myLinkType, myUrl, attributes, myStatus); }
public ResolvedLink withTarget(CharSequence target) { String haveTarget = myAttributes == null ? null : myAttributes.getValue(Attribute.TARGET_ATTR); if (target == haveTarget || haveTarget != null && haveTarget.equals(target)) return this; Attributes attributes = new Attributes(myAttributes); if (target == null) { attributes.remove(Attribute.TARGET_ATTR); if (attributes.isEmpty()) attributes = null; } else { attributes.replaceValue(Attribute.TARGET_ATTR, target); } return new ResolvedLink(myLinkType, myUrl, attributes, myStatus); }