Class Marker.MarkerBuilder

java.lang.Object
io.jenkins.plugins.prism.Marker.MarkerBuilder
Enclosing class:
Marker

public static class Marker.MarkerBuilder extends Object
Creates markers using the builder pattern.
Author:
Ullrich Hafner
  • Constructor Details

    • MarkerBuilder

      public MarkerBuilder()
  • Method Details

    • withId

      public Marker.MarkerBuilder withId(String id)
      Defines the ID of the marker. The ID is used as ID of the HTML element that shows the marker in the source code view, so it must be unique within a source code view. If no ID is defined, then a unique ID is generated when the source code is rendered.
      Parameters:
      id - the ID of the marker
      Returns:
      this builder
    • withSeverity

      public Marker.MarkerBuilder withSeverity(Marker.Severity severity)
      Defines the severity of the marker. If no severity is defined, then Marker.Severity.WARNING is used.
      Parameters:
      severity - the severity of the marker
      Returns:
      this builder
    • withBadge

      public Marker.MarkerBuilder withBadge(String text)
      Adds a badge to the marker. The badges are shown in the order they have been added.
      Parameters:
      text - the text of the badge, must not contain HTML tags
      Returns:
      this builder
    • withBadge

      public Marker.MarkerBuilder withBadge(String text, String tooltip)
      Adds a badge with a tooltip to the marker. The badges are shown in the order they have been added.
      Parameters:
      text - the text of the badge, must not contain HTML tags
      tooltip - the tooltip of the badge
      Returns:
      this builder
    • withBadge

      public Marker.MarkerBuilder withBadge(String text, String tooltip, String url)
      Adds a badge with a tooltip to the marker that is a link, e.g., to the commit of the marked lines. The badges are shown in the order they have been added.
      Parameters:
      text - the text of the badge, must not contain HTML tags
      tooltip - the tooltip of the badge
      url - the URL of the badge, use an empty string if the badge is no link
      Returns:
      this builder
    • withLink

      public Marker.MarkerBuilder withLink(String label, String url)
      Adds a link to the marker. The links are shown in the order they have been added.
      Parameters:
      label - the label of the link, must not contain HTML tags
      url - the URL of the link
      Returns:
      this builder
    • withLink

      public Marker.MarkerBuilder withLink(String label, String url, String icon)
      Adds a link with an icon to the marker. The links are shown in the order they have been added.
      Parameters:
      label - the label of the link, must not contain HTML tags
      url - the URL of the link
      icon - the icon of the link (a symbol or the URL of an image)
      Returns:
      this builder
    • withData

      public Marker.MarkerBuilder withData(String name, String value)
      Adds additional data to the marker. The data is rendered as an attribute data-marker-<name> of the box of the marker, so client side scripts can use the data, e.g., to filter the markers.
      Parameters:
      name - the name of the data, must consist of lowercase letters, digits, and hyphens and must start with a letter
      value - the value of the data
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the name is not valid
    • withNavigation

      public Marker.MarkerBuilder withNavigation()
      Adds the marker to the navigation between the markers, even if it has neither a title nor a description. Then the keys j and k, the floating buttons, and the overview ruler select the marker as well: the lines of the selected marker are highlighted, and the view scrolls to its first line. Use this option for markers that only highlight lines, e.g., a block of lines that is not covered by tests. Markers with a title or a description are always part of the navigation.
      Returns:
      this builder
    • withTitle

      public Marker.MarkerBuilder withTitle(String title)
      Defines the title of the marker. This title must not contain HTML tags.
      Parameters:
      title - the title, should fit into a single line
      Returns:
      this builder
    • withIcon

      public Marker.MarkerBuilder withIcon(String icon)
      Defines the icon of the marker.
      Parameters:
      icon - the icon (if available use an SVG icon)
      Returns:
      this builder
    • withDescription

      public Marker.MarkerBuilder withDescription(String description)
      Defines the title of the marker.
      Parameters:
      description - the detailed description of the maker. This description may contain valid HTML elements.
      Returns:
      this builder
    • withLineStart

      public Marker.MarkerBuilder withLineStart(int lineStart)
      Defines the first line of this marker (lines start at 1; 0 indicates the whole file).
      Parameters:
      lineStart - the first line
      Returns:
      this builder
    • withLineEnd

      public Marker.MarkerBuilder withLineEnd(int lineEnd)
      Defines the last line of this marker (lines start at 1).
      Parameters:
      lineEnd - the last line
      Returns:
      this builder
    • withColumnStart

      public Marker.MarkerBuilder withColumnStart(int columnStart)
      Defines the first column of this marker (columns start at 1, 0 indicates the whole line).
      Parameters:
      columnStart - the first column
      Returns:
      this builder
    • withColumnEnd

      public Marker.MarkerBuilder withColumnEnd(int columnEnd)
      Defines the last column of this marker (columns start at 1).
      Parameters:
      columnEnd - the last column
      Returns:
      this builder
    • build

      public Marker build()
      Creates an immutable Marker instance using the configured properties.
      Returns:
      the new annotation