Package com.orbitz.consul.model.agent
Class ImmutableServiceProxy.Builder
- java.lang.Object
-
- com.orbitz.consul.model.agent.ImmutableServiceProxy.Builder
-
- Enclosing class:
- ImmutableServiceProxy
@NotThreadSafe public static final class ImmutableServiceProxy.Builder extends java.lang.ObjectBuilds instances of typeImmutableServiceProxy. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis 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 Type Method Description ImmutableServiceProxy.BuilderaddAllUpstreams(java.lang.Iterable<? extends ServiceProxyUpstream> elements)Adds elements toupstreamslist.ImmutableServiceProxy.BuilderaddUpstreams(ServiceProxyUpstream element)Adds one element toupstreamslist.ImmutableServiceProxy.BuilderaddUpstreams(ServiceProxyUpstream... elements)Adds elements toupstreamslist.ImmutableServiceProxybuild()Builds a newImmutableServiceProxy.ImmutableServiceProxy.Builderconfig(java.util.Map<java.lang.String,? extends java.lang.String> entries)Sets or replaces all mappings from the specified map as entries for theconfigmap.ImmutableServiceProxy.BuilderdestinationServiceId(java.lang.String destinationServiceId)Initializes the value for thedestinationServiceIdattribute.ImmutableServiceProxy.BuilderdestinationServiceName(java.lang.String destinationServiceName)Initializes the value for thedestinationServiceNameattribute.ImmutableServiceProxy.Builderfrom(ServiceProxy instance)Fill a builder with attribute values from the providedServiceProxyinstance.ImmutableServiceProxy.BuilderlocalServiceAddress(java.lang.String localServiceAddress)Initializes the value for thelocalServiceAddressattribute.ImmutableServiceProxy.BuilderlocalServicePort(int localServicePort)Initializes the value for thelocalServicePortattribute.ImmutableServiceProxy.BuilderputAllConfig(java.util.Map<java.lang.String,? extends java.lang.String> entries)Put all mappings from the specified map as entries toconfigmap.ImmutableServiceProxy.BuilderputConfig(java.lang.String key, java.lang.String value)Put one entry to theconfigmap.ImmutableServiceProxy.BuilderputConfig(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)Put one entry to theconfigmap.ImmutableServiceProxy.Builderupstreams(java.lang.Iterable<? extends ServiceProxyUpstream> elements)Sets or replaces all elements forupstreamslist.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder from(ServiceProxy instance)
Fill a builder with attribute values from the providedServiceProxyinstance. 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
-
destinationServiceName
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder destinationServiceName(java.lang.String destinationServiceName)
Initializes the value for thedestinationServiceNameattribute.- Parameters:
destinationServiceName- The value for destinationServiceName- Returns:
thisbuilder for use in a chained invocation
-
destinationServiceId
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder destinationServiceId(java.lang.String destinationServiceId)
Initializes the value for thedestinationServiceIdattribute.- Parameters:
destinationServiceId- The value for destinationServiceId- Returns:
thisbuilder for use in a chained invocation
-
localServiceAddress
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder localServiceAddress(java.lang.String localServiceAddress)
Initializes the value for thelocalServiceAddressattribute.- Parameters:
localServiceAddress- The value for localServiceAddress- Returns:
thisbuilder for use in a chained invocation
-
localServicePort
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder localServicePort(int localServicePort)
Initializes the value for thelocalServicePortattribute.- Parameters:
localServicePort- The value for localServicePort- Returns:
thisbuilder for use in a chained invocation
-
putConfig
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder putConfig(java.lang.String key, java.lang.String value)
Put one entry to theconfigmap.- Parameters:
key- The key in the config mapvalue- The associated value in the config map- Returns:
thisbuilder for use in a chained invocation
-
putConfig
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder putConfig(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)
Put one entry to theconfigmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
config
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder config(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Sets or replaces all mappings from the specified map as entries for theconfigmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the config map- Returns:
thisbuilder for use in a chained invocation
-
putAllConfig
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder putAllConfig(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Put all mappings from the specified map as entries toconfigmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the config map- Returns:
thisbuilder for use in a chained invocation
-
addUpstreams
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder addUpstreams(ServiceProxyUpstream element)
Adds one element toupstreamslist.- Parameters:
element- A upstreams element- Returns:
thisbuilder for use in a chained invocation
-
addUpstreams
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder addUpstreams(ServiceProxyUpstream... elements)
Adds elements toupstreamslist.- Parameters:
elements- An array of upstreams elements- Returns:
thisbuilder for use in a chained invocation
-
upstreams
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder upstreams(java.lang.Iterable<? extends ServiceProxyUpstream> elements)
Sets or replaces all elements forupstreamslist.- Parameters:
elements- An iterable of upstreams elements- Returns:
thisbuilder for use in a chained invocation
-
addAllUpstreams
@CanIgnoreReturnValue public final ImmutableServiceProxy.Builder addAllUpstreams(java.lang.Iterable<? extends ServiceProxyUpstream> elements)
Adds elements toupstreamslist.- Parameters:
elements- An iterable of upstreams elements- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableServiceProxy build()
Builds a newImmutableServiceProxy.- Returns:
- An immutable instance of ServiceProxy
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-