Class ImmutableServiceProxy.Builder

java.lang.Object
org.kiwiproject.consul.model.agent.ImmutableServiceProxy.Builder
Enclosing class:
ImmutableServiceProxy

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

    • 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(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(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(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(String key, 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(Map.Entry<String,? extends 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(Map<String,? extends 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(Map<String,? extends 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
    • addUpstreams

      @CanIgnoreReturnValue public final ImmutableServiceProxy.Builder addUpstreams(ServiceProxyUpstream element)
      Adds one element to upstreams list.
      Parameters:
      element - A upstreams element
      Returns:
      this builder for use in a chained invocation
    • addUpstreams

      @CanIgnoreReturnValue public final ImmutableServiceProxy.Builder addUpstreams(ServiceProxyUpstream... elements)
      Adds elements to upstreams list.
      Parameters:
      elements - An array of upstreams elements
      Returns:
      this builder for use in a chained invocation
    • upstreams

      @CanIgnoreReturnValue public final ImmutableServiceProxy.Builder upstreams(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(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:
      IllegalStateException - if any required attributes are missing