Class ImmutableIncrementalCache.Builder
java.lang.Object
io.github.ascopes.protobufmavenplugin.sources.incremental.ImmutableIncrementalCache.Builder
- Enclosing class:
ImmutableIncrementalCache
Builds instances of type
ImmutableIncrementalCache
.
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableIncrementalCache
.dependencies
(Map<? extends Path, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for thedependencies
map.from
(IncrementalCache instance) Fill a builder with attribute values from the providedIncrementalCache
instance.putAllDependencies
(Map<? extends Path, ? extends String> entries) Put all mappings from the specified map as entries todependencies
map.putAllSources
(Map<? extends Path, ? extends String> entries) Put all mappings from the specified map as entries tosources
map.putDependencies
(Path key, String value) Put one entry to thedependencies
map.putDependencies
(Map.Entry<? extends Path, ? extends String> entry) Put one entry to thedependencies
map.putSources
(Path key, String value) Put one entry to thesources
map.putSources
(Map.Entry<? extends Path, ? extends String> entry) Put one entry to thesources
map.Sets or replaces all mappings from the specified map as entries for thesources
map.
-
Field Details
-
dependencies
-
sources
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedIncrementalCache
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
-
putDependencies
Put one entry to thedependencies
map.- Parameters:
key
- The key in the dependencies mapvalue
- The associated value in the dependencies map- Returns:
this
builder for use in a chained invocation
-
putDependencies
public final ImmutableIncrementalCache.Builder putDependencies(Map.Entry<? extends Path, ? extends String> entry) Put one entry to thedependencies
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
dependencies
public final ImmutableIncrementalCache.Builder dependencies(Map<? extends Path, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for thedependencies
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the dependencies map- Returns:
this
builder for use in a chained invocation
-
putAllDependencies
public final ImmutableIncrementalCache.Builder putAllDependencies(Map<? extends Path, ? extends String> entries) Put all mappings from the specified map as entries todependencies
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the dependencies map- Returns:
this
builder for use in a chained invocation
-
putSources
Put one entry to thesources
map.- Parameters:
key
- The key in the sources mapvalue
- The associated value in the sources map- Returns:
this
builder for use in a chained invocation
-
putSources
public final ImmutableIncrementalCache.Builder putSources(Map.Entry<? extends Path, ? extends String> entry) Put one entry to thesources
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
sources
public final ImmutableIncrementalCache.Builder sources(Map<? extends Path, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for thesources
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the sources map- Returns:
this
builder for use in a chained invocation
-
putAllSources
public final ImmutableIncrementalCache.Builder putAllSources(Map<? extends Path, ? extends String> entries) Put all mappings from the specified map as entries tosources
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the sources map- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableIncrementalCache
.- Returns:
- An immutable instance of IncrementalCache
- Throws:
IllegalStateException
- if any required attributes are missing
-