Class ImmutableCatalogNode.Builder

java.lang.Object
org.kiwiproject.consul.model.catalog.ImmutableCatalogNode.Builder
Enclosing class:
ImmutableCatalogNode

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

      @CanIgnoreReturnValue public final ImmutableCatalogNode.Builder node(Node node)
      Initializes the value for the node attribute.
      Parameters:
      node - The value for node
      Returns:
      this builder for use in a chained invocation
    • putServices

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

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

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

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

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