Class ImmutableDescriptorListing.Builder
java.lang.Object
io.github.ascopes.protobufmavenplugin.sources.ImmutableDescriptorListing.Builder
- Enclosing class:
ImmutableDescriptorListing
Builds instances of type
ImmutableDescriptorListing
.
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 TypeMethodDescriptionaddAllSourceFiles
(Iterable<String> elements) Adds elements tosourceFiles
set.addSourceFiles
(String element) Adds one element tosourceFiles
set.addSourceFiles
(String... elements) Adds elements tosourceFiles
set.build()
Builds a newImmutableDescriptorListing
.descriptorFilePath
(Path descriptorFilePath) Initializes the value for thedescriptorFilePath
attribute.from
(DescriptorListing instance) Fill a builder with attribute values from the providedDescriptorListing
instance.sourceFiles
(Iterable<String> elements) Sets or replaces all elements forsourceFiles
set.
-
Method Details
-
from
Fill a builder with attribute values from the providedDescriptorListing
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
-
descriptorFilePath
Initializes the value for thedescriptorFilePath
attribute.- Parameters:
descriptorFilePath
- The value for descriptorFilePath (can benull
)- Returns:
this
builder for use in a chained invocation
-
addSourceFiles
Adds one element tosourceFiles
set.- Parameters:
element
- A sourceFiles element- Returns:
this
builder for use in a chained invocation
-
addSourceFiles
Adds elements tosourceFiles
set.- Parameters:
elements
- An array of sourceFiles elements- Returns:
this
builder for use in a chained invocation
-
sourceFiles
Sets or replaces all elements forsourceFiles
set.- Parameters:
elements
- An iterable of sourceFiles elements- Returns:
this
builder for use in a chained invocation
-
addAllSourceFiles
Adds elements tosourceFiles
set.- Parameters:
elements
- An iterable of sourceFiles elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableDescriptorListing
.- Returns:
- An immutable instance of DescriptorListing
- Throws:
IllegalStateException
- if any required attributes are missing
-