Package cdc.issues

Class Issue.Builder<B extends Issue.Builder<B>>

java.lang.Object
cdc.issues.Issue.Builder<B>
Type Parameters:
B - The builder type.
All Implemented Interfaces:
LabelsBuilding<B>, MetasBuilding<B>
Enclosing class:
Issue

public static class Issue.Builder<B extends Issue.Builder<B>> extends Object implements MetasBuilding<B>, LabelsBuilding<B>
Builder of Issue.

This class should be derived to construct specializations of Issue.

  • Field Details

  • Constructor Details

    • Builder

      protected Builder()
  • Method Details

    • self

      public B self()
      Specified by:
      self in interface MetasBuilding<B extends Issue.Builder<B>>
      Returns:
      This builder.
    • accept

      public B accept(Consumer<? super B> consumer)
    • issue

      public B issue(Issue issue)
      Initializes this Builder with an existing issue.
      Parameters:
      issue - The issue.
      Returns:
      This builder.
    • timestamp

      public B timestamp(Instant timestamp)
      Sets the issue timestamp.

      WARNING: this should only be used to reconstruct an issue -from a file, stream, ...).

      Parameters:
      timestamp - The timestamp.
      Returns:
      This builder.
    • rule

      public B rule(Rule rule)
      Sets the issue Rule.

      This is equivalent to setting its domain, name, and severity.

      Parameters:
      rule - The rule.
      Returns:
      This builder.
    • ruleId

      public B ruleId(RuleId ruleId)
      Sets the issue RuleId.

      This is equivalent to setting its domain and name.

      Parameters:
      ruleId - The rule id.
      Returns:
      This builder.
    • domain

      public B domain(String domain)
      Sets the issue rule domain.
      Parameters:
      domain - The rule domain.
      Returns:
      This builder.
    • name

      public B name(String name)
      Sets the issue rule name.
      Parameters:
      name - The rule name.
      Returns:
      This builder.
    • name

      public B name(Enum<?> name)
      Sets the issue rule name, and optionally its severity if the name implements IssueSeverityItem and current severity is null.
      Parameters:
      name - The rule name.
      Returns:
      This builder.
    • title

      public B title(String title)
      Sets the issue rule title.
      Parameters:
      title - The rule title.
      Returns:
      This builder.
    • params

      public B params(Params params)
    • project

      public B project(String project)
      Sets the project name (may be null).
      Parameters:
      project - The project name.
      Returns:
      This builder.
    • addLocation

      public B addLocation(Location location)
      Adds an issue location.
      Parameters:
      location - The location.
      Returns:
      This builder.
    • location

      public B location(Location location)
      Sets the issue location.
      Parameters:
      location - The location.
      Returns:
      This builder.
    • location

      public B location(LocatedItem item)
      Sets the issue location.
      Parameters:
      item - The LocatedItem whose location is used.
      Returns:
      This builder.
    • locations

      public B locations(Location... locations)
      Sets the issue locations.
      Parameters:
      locations - The locations
      Returns:
      This builder.
    • locations

      public B locations(List<? extends Location> locations)
      Sets the issue locations.
      Parameters:
      locations - The locations
      Returns:
      This builder.
    • snapshot

      public B snapshot(String snapshot)
      Sets the issue snapshot.
      Parameters:
      snapshot - The snapshot identifier.
      Returns:
      This builder.
    • severity

      public B severity(IssueSeverity severity)
      Sets the issue severity.
      Parameters:
      severity - The severity.
      Returns:
      This builder.
    • description

      public B description(String description)
      Sets the issue description.
      Parameters:
      description - The description.
      Returns:
      This builder.
    • description

      public B description(StructuredDescription.Builder<?> description)
      Sets the issue description.

      The passed builder is built to a StructuredDescription which is then converted to String.

      Parameters:
      description - The description.
      Returns:
      This builder.
    • description

      public B description(Object description)
      Sets the issue description.

      Object.toString() is used.

      Parameters:
      description - The description.
      Returns:
      This builder.
    • meta

      public B meta(String name, String value)
      Description copied from interface: MetasBuilding
      Adds a new or replaces an existing (name, value) pair.
      Specified by:
      meta in interface MetasBuilding<B extends Issue.Builder<B>>
      Parameters:
      name - The meta name.
      value - The meta value.
      Returns:
      This builder.
    • meta

      public B meta(String name, String value, String separator)
      Description copied from interface: MetasBuilding
      Adds a new or modifies an existing (name, value) pair.

      If no value is associated to name, behaves like meta(name, value). Otherwise, modify the value associated to name by appending separator and value.

      Specified by:
      meta in interface MetasBuilding<B extends Issue.Builder<B>>
      Parameters:
      name - The meta name.
      value - The meta value.
      separator - The separator.
      Returns:
      This builder.
    • metas

      public B metas(Metas metas)
      Description copied from interface: MetasBuilding
      Adds new or replaces existing (name, value) pairs.
      Specified by:
      metas in interface MetasBuilding<B extends Issue.Builder<B>>
      Parameters:
      metas - The meta data.
      Returns:
      This builder.
    • labels

      public B labels(Labels labels)
      Description copied from interface: LabelsBuilding
      Sets the labels.
      Specified by:
      labels in interface LabelsBuilding<B extends Issue.Builder<B>>
      Parameters:
      labels - The labels.
      Returns:
      This builder.
    • build

      public Issue build()