Package cdc.issues

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

  • Type Parameters:
    B - The builder type.
    Enclosing class:
    Issue

    public static class Issue.Builder<B extends Issue.Builder<B>>
    extends Object
    Builder of Issue.

    This class should be derived to construct specializations of Issue.

    • Constructor Detail

      • Builder

        protected Builder()
    • Method Detail

      • self

        protected B self()
      • accept

        public B accept​(Consumer<? super B> consumer)
      • 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 and name, and its severity if the rule has one 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 domain.
        Parameters:
        domain - The domain.
        Returns:
        This builder.
      • name

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

        public B name​(Enum<?> name)
        Sets the issue name, and optionally its severity if the name implements IssueSeverityItem and current severity is null.
        Parameters:
        name - The name.
        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<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.
      • metas

        public B metas​(Params metas)
        Sets the issue meta data.
        Parameters:
        metas - The meta data.
        Returns:
        This builder.
      • build

        public Issue build()