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
    • addSourceFiles

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

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

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

      public final ImmutableSourceListing.Builder addAllSourceFiles(Iterable<? extends Path> elements)
      Adds elements to sourceFiles set.
      Parameters:
      elements - An iterable of sourceFiles 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