Class ImmutableCatalogNode.Builder
java.lang.Object
org.kiwiproject.consul.model.catalog.ImmutableCatalogNode.Builder
- Enclosing class:
- ImmutableCatalogNode
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 Summary
Modifier and TypeMethodDescriptionbuild()Builds a newImmutableCatalogNode.from(CatalogNode instance) Fill a builder with attribute values from the providedCatalogNodeinstance.Initializes the value for thenodeattribute.putAllServices(Map<String, ? extends Service> entries) Put all mappings from the specified map as entries toservicesmap.putServices(String key, Service value) Put one entry to theservicesmap.putServices(Map.Entry<String, ? extends Service> entry) Put one entry to theservicesmap.Sets or replaces all mappings from the specified map as entries for theservicesmap.
-
Method Details
-
from
Fill a builder with attribute values from the providedCatalogNodeinstance. 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:
thisbuilder for use in a chained invocation
-
node
Initializes the value for thenodeattribute.- Parameters:
node- The value for node- Returns:
thisbuilder for use in a chained invocation
-
putServices
@CanIgnoreReturnValue public final ImmutableCatalogNode.Builder putServices(String key, Service value) Put one entry to theservicesmap.- Parameters:
key- The key in the services mapvalue- The associated value in the services map- Returns:
thisbuilder for use in a chained invocation
-
putServices
@CanIgnoreReturnValue public final ImmutableCatalogNode.Builder putServices(Map.Entry<String, ? extends Service> entry) Put one entry to theservicesmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder 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 theservicesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the services map- Returns:
thisbuilder 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 toservicesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the services map- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableCatalogNode.- Returns:
- An immutable instance of CatalogNode
- Throws:
IllegalStateException- if any required attributes are missing
-