Class ImmutableRegistration.Builder

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

public static final class ImmutableRegistration.Builder extends Object
Builds instances of type ImmutableRegistration. 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 ImmutableRegistration.Builder from(Registration instance)
      Fill a builder with attribute values from the provided Registration 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 ImmutableRegistration.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
    • id

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder id(String id)
      Initializes the value for the id attribute.
      Parameters:
      id - The value for id
      Returns:
      this builder for use in a chained invocation
    • address

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder address(String address)
      Initializes the optional value address to address.
      Parameters:
      address - The value for address
      Returns:
      this builder for chained invocation
    • address

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder address(Optional<String> address)
      Initializes the optional value address to address.
      Parameters:
      address - The value for address
      Returns:
      this builder for use in a chained invocation
    • port

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder port(int port)
      Initializes the optional value port to port.
      Parameters:
      port - The value for port
      Returns:
      this builder for chained invocation
    • port

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder port(Optional<Integer> port)
      Initializes the optional value port to port.
      Parameters:
      port - The value for port
      Returns:
      this builder for use in a chained invocation
    • check

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder check(Registration.RegCheck check)
      Initializes the optional value check to check.
      Parameters:
      check - The value for check
      Returns:
      this builder for chained invocation
    • check

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder check(Optional<? extends Registration.RegCheck> check)
      Initializes the optional value check to check.
      Parameters:
      check - The value for check
      Returns:
      this builder for use in a chained invocation
    • addChecks

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addChecks(Registration.RegCheck element)
      Adds one element to checks list.
      Parameters:
      element - A checks element
      Returns:
      this builder for use in a chained invocation
    • addChecks

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addChecks(Registration.RegCheck... elements)
      Adds elements to checks list.
      Parameters:
      elements - An array of checks elements
      Returns:
      this builder for use in a chained invocation
    • checks

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder checks(Iterable<? extends Registration.RegCheck> elements)
      Sets or replaces all elements for checks list.
      Parameters:
      elements - An iterable of checks elements
      Returns:
      this builder for use in a chained invocation
    • addAllChecks

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addAllChecks(Iterable<? extends Registration.RegCheck> elements)
      Adds elements to checks list.
      Parameters:
      elements - An iterable of checks elements
      Returns:
      this builder for use in a chained invocation
    • addTags

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addTags(String element)
      Adds one element to tags list.
      Parameters:
      element - A tags element
      Returns:
      this builder for use in a chained invocation
    • addTags

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addTags(String... elements)
      Adds elements to tags list.
      Parameters:
      elements - An array of tags elements
      Returns:
      this builder for use in a chained invocation
    • tags

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder tags(Iterable<String> elements)
      Sets or replaces all elements for tags list.
      Parameters:
      elements - An iterable of tags elements
      Returns:
      this builder for use in a chained invocation
    • addAllTags

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder addAllTags(Iterable<String> elements)
      Adds elements to tags list.
      Parameters:
      elements - An iterable of tags elements
      Returns:
      this builder for use in a chained invocation
    • putMeta

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

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

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

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

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder enableTagOverride(boolean enableTagOverride)
      Initializes the optional value enableTagOverride to enableTagOverride.
      Parameters:
      enableTagOverride - The value for enableTagOverride
      Returns:
      this builder for chained invocation
    • enableTagOverride

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder enableTagOverride(Optional<Boolean> enableTagOverride)
      Initializes the optional value enableTagOverride to enableTagOverride.
      Parameters:
      enableTagOverride - The value for enableTagOverride
      Returns:
      this builder for use in a chained invocation
    • serviceWeights

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder serviceWeights(ServiceWeights serviceWeights)
      Initializes the optional value serviceWeights to serviceWeights.
      Parameters:
      serviceWeights - The value for serviceWeights
      Returns:
      this builder for chained invocation
    • serviceWeights

      @CanIgnoreReturnValue public final ImmutableRegistration.Builder serviceWeights(Optional<? extends ServiceWeights> serviceWeights)
      Initializes the optional value serviceWeights to serviceWeights.
      Parameters:
      serviceWeights - The value for serviceWeights
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableRegistration build()
      Builds a new ImmutableRegistration.
      Returns:
      An immutable instance of Registration
      Throws:
      IllegalStateException - if any required attributes are missing