Class ImmutableModule.Builder

  • Enclosing class:
    ImmutableModule

    @NotThreadSafe
    public static final class ImmutableModule.Builder
    extends Object
    Builds instances of type ImmutableModule. 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 Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder from​(Module instance)
        Fill a builder with attribute values from the provided Module 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
      • name

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder name​(String name)
        Initializes the value for the name attribute.
        Parameters:
        name - The value for name
        Returns:
        this builder for use in a chained invocation
      • addProtos

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder addProtos​(Proto element)
        Adds one element to protos list.
        Parameters:
        element - A protos element
        Returns:
        this builder for use in a chained invocation
      • addProtos

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder addProtos​(Proto... elements)
        Adds elements to protos list.
        Parameters:
        elements - An array of protos elements
        Returns:
        this builder for use in a chained invocation
      • protos

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder protos​(Iterable<? extends Proto> elements)
        Sets or replaces all elements for protos list.
        Parameters:
        elements - An iterable of protos elements
        Returns:
        this builder for use in a chained invocation
      • addAllProtos

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder addAllProtos​(Iterable<? extends Proto> elements)
        Adds elements to protos list.
        Parameters:
        elements - An iterable of protos elements
        Returns:
        this builder for use in a chained invocation
      • output

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder output​(String output)
        Initializes the value for the output attribute.
        Parameters:
        output - The value for output
        Returns:
        this builder for use in a chained invocation
      • putOptions

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder putOptions​(String key,
                                                        Object value)
        Put one entry to the options map.
        Parameters:
        key - The key in the options map
        value - The associated value in the options map
        Returns:
        this builder for use in a chained invocation
      • putOptions

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder putOptions​(Map.Entry<String,​? extends Object> entry)
        Put one entry to the options map. Nulls are not permitted
        Parameters:
        entry - The key and value entry
        Returns:
        this builder for use in a chained invocation
      • options

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder options​(Map<String,​? extends Object> entries)
        Sets or replaces all mappings from the specified map as entries for the options map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the options map
        Returns:
        this builder for use in a chained invocation
      • putAllOptions

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder putAllOptions​(Map<String,​? extends Object> entries)
        Put all mappings from the specified map as entries to options map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the options map
        Returns:
        this builder for use in a chained invocation
      • usageIndex

        @CanIgnoreReturnValue
        public final ImmutableModule.Builder usageIndex​(UsageIndex usageIndex)
        Initializes the value for the usageIndex attribute.
        Parameters:
        usageIndex - The value for usageIndex
        Returns:
        this builder for use in a chained invocation