Class RemoteAPI.Builder
- java.lang.Object
-
- com.github.m0nk3y2k4.thetvdb.internal.connection.RemoteAPI.Builder
-
- Enclosing class:
- RemoteAPI
public static class RemoteAPI.Builder extends Object
Builder used to create a new immutableRemoteAPIimplementation
This builder provides a fluent API for setting certain object properties and creating a new immutableRemoteAPIinstance based on these properties. New builders may be initialized with some existing API instance or even aProxy, which presets the builders properties to the values of the given object, still retaining the option to make additional changes before actually building a new immutable instance.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteAPIbuild()Builds a newRemoteAPI.RemoteAPI.Builderfrom(Proxy instance)Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.api.Proxyinstance.RemoteAPI.Builderfrom(RemoteAPI instance)Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.connection.RemoteAPIinstance.RemoteAPI.Builderhost(String host)Initializes the value for thehostattribute.RemoteAPI.Builderpath(String path)Initializes the optional valuepathto path.RemoteAPI.Builderpath(Optional<String> path)Initializes the optional valuepathto path.RemoteAPI.Builderport(int port)Initializes the value for theportattribute.RemoteAPI.Builderprotocol(String protocol)Initializes the value for theprotocolattribute.
-
-
-
Method Detail
-
from
public final RemoteAPI.Builder from(RemoteAPI instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.connection.RemoteAPIinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
public final RemoteAPI.Builder from(Proxy instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.api.Proxyinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
path
public final RemoteAPI.Builder path(String path)
Initializes the optional valuepathto path.- Parameters:
path- The value for path- Returns:
thisbuilder for chained invocation
-
path
public final RemoteAPI.Builder path(Optional<String> path)
Initializes the optional valuepathto path.- Parameters:
path- The value for path- Returns:
thisbuilder for use in a chained invocation
-
protocol
public final RemoteAPI.Builder protocol(String protocol)
Initializes the value for theprotocolattribute.If not set, this attribute will have a default value as returned by the initializer of
protocol.- Parameters:
protocol- The value for protocol- Returns:
thisbuilder for use in a chained invocation
-
host
public final RemoteAPI.Builder host(String host)
Initializes the value for thehostattribute.If not set, this attribute will have a default value as returned by the initializer of
host.- Parameters:
host- The value for host- Returns:
thisbuilder for use in a chained invocation
-
port
public final RemoteAPI.Builder port(int port)
Initializes the value for theportattribute.If not set, this attribute will have a default value as returned by the initializer of
port.- Parameters:
port- The value for port- Returns:
thisbuilder for use in a chained invocation
-
build
public RemoteAPI build()
Builds a newRemoteAPI.- Returns:
- An immutable instance of RemoteAPI
- Throws:
IllegalStateException- if any required attributes are missing
-
-