Class ImmutableAgent.Builder

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

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

      @CanIgnoreReturnValue public final ImmutableAgent.Builder config(Config config)
      Initializes the value for the config attribute.
      Parameters:
      config - The value for config
      Returns:
      this builder for use in a chained invocation
    • debugConfig

      @CanIgnoreReturnValue public final ImmutableAgent.Builder debugConfig(@Nullable DebugConfig debugConfig)
      Initializes the value for the debugConfig attribute.
      Parameters:
      debugConfig - The value for debugConfig (can be null)
      Returns:
      this builder for use in a chained invocation
    • member

      @CanIgnoreReturnValue public final ImmutableAgent.Builder member(Member member)
      Initializes the value for the member attribute.
      Parameters:
      member - The value for member
      Returns:
      this builder for use in a chained invocation
    • putMeta

      @CanIgnoreReturnValue public final ImmutableAgent.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 ImmutableAgent.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 ImmutableAgent.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 ImmutableAgent.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
    • build

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