Class ImmutableSourceListing.Builder
java.lang.Object
io.github.ascopes.protobufmavenplugin.sources.ImmutableSourceListing.Builder
- Enclosing class:
ImmutableSourceListing
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 Summary
Modifier and TypeMethodDescriptionaddAllSourceProtoFiles
(Iterable<? extends Path> elements) Adds elements tosourceProtoFiles
set.addSourceProtoFiles
(Path element) Adds one element tosourceProtoFiles
set.addSourceProtoFiles
(Path... elements) Adds elements tosourceProtoFiles
set.build()
Builds a newImmutableSourceListing
.from
(SourceListing instance) Fill a builder with attribute values from the providedSourceListing
instance.sourceProtoFiles
(Iterable<? extends Path> elements) Sets or replaces all elements forsourceProtoFiles
set.sourceRoot
(Path sourceRoot) Initializes the value for thesourceRoot
attribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedSourceListing
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
Initializes the value for thesourceRoot
attribute.- Parameters:
sourceRoot
- The value for sourceRoot (can benull
)- Returns:
this
builder for use in a chained invocation
-
addSourceProtoFiles
Adds one element tosourceProtoFiles
set.- Parameters:
element
- A sourceProtoFiles element- Returns:
this
builder for use in a chained invocation
-
addSourceProtoFiles
Adds elements tosourceProtoFiles
set.- Parameters:
elements
- An array of sourceProtoFiles elements- Returns:
this
builder for use in a chained invocation
-
sourceProtoFiles
Sets or replaces all elements forsourceProtoFiles
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 tosourceProtoFiles
set.- Parameters:
elements
- An iterable of sourceProtoFiles elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableSourceListing
.- Returns:
- An immutable instance of SourceListing
- Throws:
IllegalStateException
- if any required attributes are missing
-