public void addLink(String label, String url) { this.links.add(Link.to(label, url)); }
/** * Create a new {@link Link} instance with the given target and title. */ public static Link to(String description, String link) { return new Link(link, description); }
public void addLink(String label, String url) { this.links.add(Link.to(label, url)); }
/** * Create a new {@link Link} instance with the given target and title. */ public static Link to(String description, String link) { return new Link(link, description); }
@Override public Link processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String link = $(element).attr(HREF_ATTR); if (StringUtils.isBlank(link)) { throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + HREF_ATTR + "' attribute (eg, 'http://www.example.com/somepage.html')"); } String title = $(element).attr(TITLE_ATTR); if (StringUtils.isBlank(title)) { throw new WindupException( "Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + TITLE_ATTR + "' attribute (eg, 'Documentation for XYZ')"); } return Link.to(title, link); } }
@Override public Link processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String link = $(element).attr(HREF_ATTR); if (StringUtils.isBlank(link)) { throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + HREF_ATTR + "' attribute (eg, 'http://www.example.com/somepage.html')"); } String title = $(element).attr(TITLE_ATTR); if (StringUtils.isBlank(title)) { throw new WindupException( "Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + TITLE_ATTR + "' attribute (eg, 'Documentation for XYZ')"); } return Link.to(title, link); } }