Class ImmutableSourceListing.Builder

java.lang.Object
io.github.ascopes.protobufmavenplugin.sources.ImmutableSourceListing.Builder
Enclosing class:
ImmutableSourceListing

public static final class ImmutableSourceListing.Builder extends Object
Builds instances of type ImmutableSourceListing. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      public final ImmutableSourceListing.Builder from(SourceListing instance)
      Fill a builder with attribute values from the provided SourceListing instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • sourceRoot

      public final ImmutableSourceListing.Builder sourceRoot(Path sourceRoot)
      Initializes the value for the sourceRoot attribute.
      Parameters:
      sourceRoot - The value for sourceRoot (can be null)
      Returns:
      this builder for use in a chained invocation
    • addSourceProtoFiles

      public final ImmutableSourceListing.Builder addSourceProtoFiles(Path element)
      Adds one element to sourceProtoFiles set.
      Parameters:
      element - A sourceProtoFiles element
      Returns:
      this builder for use in a chained invocation
    • addSourceProtoFiles

      public final ImmutableSourceListing.Builder addSourceProtoFiles(Path... elements)
      Adds elements to sourceProtoFiles set.
      Parameters:
      elements - An array of sourceProtoFiles elements
      Returns:
      this builder for use in a chained invocation
    • sourceProtoFiles

      public final ImmutableSourceListing.Builder sourceProtoFiles(Iterable<? extends Path> elements)
      Sets or replaces all elements for sourceProtoFiles set.
      Parameters:
      elements - An iterable of sourceProtoFiles elements
      Returns:
      this builder for use in a chained invocation
    • addAllSourceProtoFiles

      public final ImmutableSourceListing.Builder addAllSourceProtoFiles(Iterable<? extends Path> elements)
      Adds elements to sourceProtoFiles set.
      Parameters:
      elements - An iterable of sourceProtoFiles elements
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableSourceListing build()
      Returns:
      An immutable instance of SourceListing
      Throws:
      IllegalStateException - if any required attributes are missing