Class Link

Direct Known Subclasses:
Image

public class Link extends InlineElement
Creates a clickable link in the Markdown Document. Allows setting both the link and the display content
Since:
0.0.12
Author:
Thomas Kwashnak
  • Constructor Details

    • Link

      public Link(String url)
      Creates a simple link that displays the same url that it links to
      Parameters:
      url - Link url
      Since:
      0.0.12
    • Link

      public Link(Object content, String url)
      Creates a link with the specified display and the url it links to
      Parameters:
      content - What you want to be displayed for the link
      url - The url that the link should link to
      Since:
      0.0.12
  • Method Details

    • asString

      public String asString()
      Formats the string into the link syntax used in Markdown
      Specified by:
      asString in class MarkdownElement
      Returns:
      String representation of the formatted item
      Since:
      0.0.12
    • checkType

      protected <T> T checkType(T object)

      Checks the type of a passed object. This method is specific to each element and throws an IllegalContentsException if the passed object cannot be put in as a content of that element. This prevents instances such as nested tables, where a table is put inside another table. If such feature is necessary, using the MarkdownElement.toString() of any markdown element will force it to be accepted in any spot

      Throws IllegalContentsException if object is an instance of the Structure class
      Throws IllegalContentsException if object is instance of the same class (such as an Italic within an Italic)
      Does not throw if the object is an instance of Image
      Overrides:
      checkType in class InlineElement
      Type Parameters:
      T - The type of the item
      Parameters:
      object - The item to check it's class
      Returns:
      That item if it is not an instance of any illegal types
      Since:
      0.0.20