Class ImmutableServiceProxy.Builder

  • Enclosing class:
    ImmutableServiceProxy

    @NotThreadSafe
    public static final class ImmutableServiceProxy.Builder
    extends java.lang.Object
    Builds instances of type ImmutableServiceProxy. 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 ImmutableServiceProxy.Builder from​(ServiceProxy instance)
        Fill a builder with attribute values from the provided ServiceProxy 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
      • destinationServiceName

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder destinationServiceName​(java.lang.String destinationServiceName)
        Initializes the value for the destinationServiceName attribute.
        Parameters:
        destinationServiceName - The value for destinationServiceName
        Returns:
        this builder for use in a chained invocation
      • destinationServiceId

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder destinationServiceId​(java.lang.String destinationServiceId)
        Initializes the value for the destinationServiceId attribute.
        Parameters:
        destinationServiceId - The value for destinationServiceId
        Returns:
        this builder for use in a chained invocation
      • localServiceAddress

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder localServiceAddress​(java.lang.String localServiceAddress)
        Initializes the value for the localServiceAddress attribute.
        Parameters:
        localServiceAddress - The value for localServiceAddress
        Returns:
        this builder for use in a chained invocation
      • localServicePort

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder localServicePort​(int localServicePort)
        Initializes the value for the localServicePort attribute.
        Parameters:
        localServicePort - The value for localServicePort
        Returns:
        this builder for use in a chained invocation
      • putConfig

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder putConfig​(java.lang.String key,
                                                             java.lang.String value)
        Put one entry to the config map.
        Parameters:
        key - The key in the config map
        value - The associated value in the config map
        Returns:
        this builder for use in a chained invocation
      • putConfig

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

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

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

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder upstreams​(java.lang.Iterable<? extends ServiceProxyUpstream> elements)
        Sets or replaces all elements for upstreams list.
        Parameters:
        elements - An iterable of upstreams elements
        Returns:
        this builder for use in a chained invocation
      • addAllUpstreams

        @CanIgnoreReturnValue
        public final ImmutableServiceProxy.Builder addAllUpstreams​(java.lang.Iterable<? extends ServiceProxyUpstream> elements)
        Adds elements to upstreams list.
        Parameters:
        elements - An iterable of upstreams elements
        Returns:
        this builder for use in a chained invocation
      • build

        public ImmutableServiceProxy build()
        Builds a new ImmutableServiceProxy.
        Returns:
        An immutable instance of ServiceProxy
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing