Package io.jenkins.plugins.prism
Class Marker.MarkerBuilder
java.lang.Object
io.jenkins.plugins.prism.Marker.MarkerBuilder
- Enclosing class:
Marker
Creates
markers using the builder pattern.- Author:
- Ullrich Hafner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates an immutableMarkerinstance using the configured properties.Adds a badge to the marker.Adds a badge with a tooltip to the marker.Adds a badge with a tooltip to the marker that is a link, e.g., to the commit of the marked lines.withColumnEnd(int columnEnd) Defines the last column of this marker (columns start at 1).withColumnStart(int columnStart) Defines the first column of this marker (columns start at 1, 0 indicates the whole line).Adds additional data to the marker.withDescription(String description) Defines the title of the marker.Defines the icon of the marker.Defines the ID of the marker.withLineEnd(int lineEnd) Defines the last line of this marker (lines start at 1).withLineStart(int lineStart) Defines the first line of this marker (lines start at 1; 0 indicates the whole file).Adds a link to the marker.Adds a link with an icon to the marker.Adds the marker to the navigation between the markers, even if it has neither a title nor a description.withSeverity(Marker.Severity severity) Defines the severity of the marker.Defines the title of the marker.
-
Constructor Details
-
MarkerBuilder
public MarkerBuilder()
-
-
Method Details
-
withId
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
Defines the severity of the marker. If no severity is defined, thenMarker.Severity.WARNINGis used.- Parameters:
severity- the severity of the marker- Returns:
- this builder
-
withBadge
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
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 tagstooltip- the tooltip of the badge- Returns:
- this builder
-
withBadge
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 tagstooltip- the tooltip of the badgeurl- the URL of the badge, use an empty string if the badge is no link- Returns:
- this builder
-
withLink
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 tagsurl- the URL of the link- Returns:
- this builder
-
withLink
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 tagsurl- the URL of the linkicon- the icon of the link (a symbol or the URL of an image)- Returns:
- this builder
-
withData
Adds additional data to the marker. The data is rendered as an attributedata-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 lettervalue- the value of the data- Returns:
- this builder
- Throws:
IllegalArgumentException- if the name is not valid
-
withTitle
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
Defines the icon of the marker.- Parameters:
icon- the icon (if available use an SVG icon)- Returns:
- this builder
-
withDescription
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
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
Defines the last line of this marker (lines start at 1).- Parameters:
lineEnd- the last line- Returns:
- this builder
-
withColumnStart
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
Defines the last column of this marker (columns start at 1).- Parameters:
columnEnd- the last column- Returns:
- this builder
-
build
Creates an immutableMarkerinstance using the configured properties.- Returns:
- the new annotation
-