Package com.github.searls.jasmine.config
Class ImmutableServerConfiguration.Builder
- java.lang.Object
-
- com.github.searls.jasmine.config.ImmutableServerConfiguration.Builder
-
- Enclosing class:
- ImmutableServerConfiguration
@NotThreadSafe public static final class ImmutableServerConfiguration.Builder extends Object
Builds instances of typeImmutableServerConfiguration. 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableServerConfigurationbuild()Builds a newImmutableServerConfiguration.ImmutableServerConfiguration.Builderfrom(ServerConfiguration instance)Fill a builder with attribute values from the providedServerConfigurationinstance.ImmutableServerConfiguration.BuilderserverHostname(String serverHostname)Initializes the value for theserverHostnameattribute.ImmutableServerConfiguration.BuilderserverPort(int serverPort)Initializes the value for theserverPortattribute.ImmutableServerConfiguration.BuilderuriScheme(String uriScheme)Initializes the value for theuriSchemeattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableServerConfiguration.Builder from(ServerConfiguration instance)
Fill a builder with attribute values from the providedServerConfigurationinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
uriScheme
@CanIgnoreReturnValue public final ImmutableServerConfiguration.Builder uriScheme(String uriScheme)
Initializes the value for theuriSchemeattribute.If not set, this attribute will have a default value as returned by the initializer of
uriScheme.- Parameters:
uriScheme- The value for uriScheme- Returns:
thisbuilder for use in a chained invocation
-
serverHostname
@CanIgnoreReturnValue public final ImmutableServerConfiguration.Builder serverHostname(String serverHostname)
Initializes the value for theserverHostnameattribute.If not set, this attribute will have a default value as returned by the initializer of
serverHostname.- Parameters:
serverHostname- The value for serverHostname- Returns:
thisbuilder for use in a chained invocation
-
serverPort
@CanIgnoreReturnValue public final ImmutableServerConfiguration.Builder serverPort(int serverPort)
Initializes the value for theserverPortattribute.If not set, this attribute will have a default value as returned by the initializer of
serverPort.- Parameters:
serverPort- The value for serverPort- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableServerConfiguration build()
Builds a newImmutableServerConfiguration.- Returns:
- An immutable instance of ServerConfiguration
- Throws:
IllegalStateException- if any required attributes are missing
-
-