All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.commonmark.node.Link Maven / Gradle / Ivy

package org.commonmark.node;

/**
 * A link with a destination and an optional title; the link text is in child nodes.
 * 

* Example for an inline link in a CommonMark document: *


 * [link](/uri "title")
 * 
*

* The corresponding Link node would look like this: *

    *
  • {@link #getDestination()} returns {@code "/uri"} *
  • {@link #getTitle()} returns {@code "title"} *
  • A {@link Text} child node with {@link Text#getLiteral() getLiteral} that returns {@code "link"}
  • *
*

* Note that the text in the link can contain inline formatting, so it could also contain an {@link Image} or * {@link Emphasis}, etc. * * @see CommonMark Spec for links */ public class Link extends Node { private String destination; private String title; public Link() { } public Link(String destination, String title) { this.destination = destination; this.title = title; } @Override public void accept(Visitor visitor) { visitor.visit(this); } public String getDestination() { return destination; } public void setDestination(String destination) { this.destination = destination; } /** * @return the title or null */ public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Override protected String toStringAttributes() { return "destination=" + destination + ", title=" + title; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy