Class ImmutableIncrementalCache.Builder

java.lang.Object
io.github.ascopes.protobufmavenplugin.sources.incremental.ImmutableIncrementalCache.Builder
Enclosing class:
ImmutableIncrementalCache

public static final class ImmutableIncrementalCache.Builder extends Object
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 Details

  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • from

      Fill a builder with attribute values from the provided IncrementalCache 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

      public final ImmutableIncrementalCache.Builder putDependencies(Path key, String value)
      Put one entry to the dependencies map.
      Parameters:
      key - The key in the dependencies map
      value - 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 the dependencies 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 the dependencies 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 to dependencies 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

      public final ImmutableIncrementalCache.Builder putSources(Path key, String value)
      Put one entry to the sources map.
      Parameters:
      key - The key in the sources map
      value - 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 the sources 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 the sources 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 to sources 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

      public ImmutableIncrementalCache build()
      Returns:
      An immutable instance of IncrementalCache
      Throws:
      IllegalStateException - if any required attributes are missing