Class ImmutableProtocInvocation.Builder
java.lang.Object
io.github.ascopes.protobufmavenplugin.protoc.ImmutableProtocInvocation.Builder
- Enclosing class:
ImmutableProtocInvocation
Builds instances of type
ImmutableProtocInvocation
.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private static final long
private static final long
private long
private boolean
private Path
private SortedSet
<ProtocTarget> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllDescriptorSourceFiles
(Iterable<String> elements) Adds elements todescriptorSourceFiles
list.addAllImportPaths
(Iterable<? extends Path> elements) Adds elements toimportPaths
list.addAllInputDescriptorFiles
(Iterable<? extends Path> elements) Adds elements toinputDescriptorFiles
list.addAllSourcePaths
(Iterable<? extends Path> elements) Adds elements tosourcePaths
list.addDescriptorSourceFiles
(String element) Adds one element todescriptorSourceFiles
list.addDescriptorSourceFiles
(String... elements) Adds elements todescriptorSourceFiles
list.addImportPaths
(Path element) Adds one element toimportPaths
list.addImportPaths
(Path... elements) Adds elements toimportPaths
list.addInputDescriptorFiles
(Path element) Adds one element toinputDescriptorFiles
list.addInputDescriptorFiles
(Path... elements) Adds elements toinputDescriptorFiles
list.addSourcePaths
(Path element) Adds one element tosourcePaths
list.addSourcePaths
(Path... elements) Adds elements tosourcePaths
list.build()
Builds a newImmutableProtocInvocation
.descriptorSourceFiles
(Iterable<String> elements) Sets or replaces all elements fordescriptorSourceFiles
list.private String
from
(ProtocInvocation instance) Fill a builder with attribute values from the providedProtocInvocation
instance.importPaths
(Iterable<? extends Path> elements) Sets or replaces all elements forimportPaths
list.inputDescriptorFiles
(Iterable<? extends Path> elements) Sets or replaces all elements forinputDescriptorFiles
list.isFatalWarnings
(boolean isFatalWarnings) Initializes the value for theisFatalWarnings
attribute.protocPath
(Path protocPath) Initializes the value for theprotocPath
attribute.sourcePaths
(Iterable<? extends Path> elements) Sets or replaces all elements forsourcePaths
list.targets
(SortedSet<ProtocTarget> targets) Initializes the value for thetargets
attribute.
-
Field Details
-
INIT_BIT_PROTOC_PATH
private static final long INIT_BIT_PROTOC_PATH- See Also:
-
INIT_BIT_IS_FATAL_WARNINGS
private static final long INIT_BIT_IS_FATAL_WARNINGS- See Also:
-
INIT_BIT_TARGETS
private static final long INIT_BIT_TARGETS- See Also:
-
initBits
private long initBits -
protocPath
-
isFatalWarnings
private boolean isFatalWarnings -
importPaths
-
inputDescriptorFiles
-
descriptorSourceFiles
-
sourcePaths
-
targets
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedProtocInvocation
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
-
protocPath
Initializes the value for theprotocPath
attribute.- Parameters:
protocPath
- The value for protocPath (can benull
)- Returns:
this
builder for use in a chained invocation
-
isFatalWarnings
Initializes the value for theisFatalWarnings
attribute.- Parameters:
isFatalWarnings
- The value for isFatalWarnings- Returns:
this
builder for use in a chained invocation
-
addImportPaths
Adds one element toimportPaths
list.- Parameters:
element
- A importPaths element- Returns:
this
builder for use in a chained invocation
-
addImportPaths
Adds elements toimportPaths
list.- Parameters:
elements
- An array of importPaths elements- Returns:
this
builder for use in a chained invocation
-
importPaths
Sets or replaces all elements forimportPaths
list.- Parameters:
elements
- An iterable of importPaths elements- Returns:
this
builder for use in a chained invocation
-
addAllImportPaths
Adds elements toimportPaths
list.- Parameters:
elements
- An iterable of importPaths elements- Returns:
this
builder for use in a chained invocation
-
addInputDescriptorFiles
Adds one element toinputDescriptorFiles
list.- Parameters:
element
- A inputDescriptorFiles element- Returns:
this
builder for use in a chained invocation
-
addInputDescriptorFiles
Adds elements toinputDescriptorFiles
list.- Parameters:
elements
- An array of inputDescriptorFiles elements- Returns:
this
builder for use in a chained invocation
-
inputDescriptorFiles
public final ImmutableProtocInvocation.Builder inputDescriptorFiles(Iterable<? extends Path> elements) Sets or replaces all elements forinputDescriptorFiles
list.- Parameters:
elements
- An iterable of inputDescriptorFiles elements- Returns:
this
builder for use in a chained invocation
-
addAllInputDescriptorFiles
public final ImmutableProtocInvocation.Builder addAllInputDescriptorFiles(Iterable<? extends Path> elements) Adds elements toinputDescriptorFiles
list.- Parameters:
elements
- An iterable of inputDescriptorFiles elements- Returns:
this
builder for use in a chained invocation
-
addDescriptorSourceFiles
Adds one element todescriptorSourceFiles
list.- Parameters:
element
- A descriptorSourceFiles element- Returns:
this
builder for use in a chained invocation
-
addDescriptorSourceFiles
Adds elements todescriptorSourceFiles
list.- Parameters:
elements
- An array of descriptorSourceFiles elements- Returns:
this
builder for use in a chained invocation
-
descriptorSourceFiles
Sets or replaces all elements fordescriptorSourceFiles
list.- Parameters:
elements
- An iterable of descriptorSourceFiles elements- Returns:
this
builder for use in a chained invocation
-
addAllDescriptorSourceFiles
public final ImmutableProtocInvocation.Builder addAllDescriptorSourceFiles(Iterable<String> elements) Adds elements todescriptorSourceFiles
list.- Parameters:
elements
- An iterable of descriptorSourceFiles elements- Returns:
this
builder for use in a chained invocation
-
addSourcePaths
Adds one element tosourcePaths
list.- Parameters:
element
- A sourcePaths element- Returns:
this
builder for use in a chained invocation
-
addSourcePaths
Adds elements tosourcePaths
list.- Parameters:
elements
- An array of sourcePaths elements- Returns:
this
builder for use in a chained invocation
-
sourcePaths
Sets or replaces all elements forsourcePaths
list.- Parameters:
elements
- An iterable of sourcePaths elements- Returns:
this
builder for use in a chained invocation
-
addAllSourcePaths
Adds elements tosourcePaths
list.- Parameters:
elements
- An iterable of sourcePaths elements- Returns:
this
builder for use in a chained invocation
-
targets
Initializes the value for thetargets
attribute.- Parameters:
targets
- The value for targets (can benull
)- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableProtocInvocation
.- Returns:
- An immutable instance of ProtocInvocation
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-