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 immutableRemoteAPI
implementation
This builder provides a fluent API for setting certain object properties and creating a new immutableRemoteAPI
instance 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 RemoteAPI
build()
Builds a newRemoteAPI
.RemoteAPI.Builder
from(Proxy instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.api.Proxy
instance.RemoteAPI.Builder
from(RemoteAPI instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.connection.RemoteAPI
instance.RemoteAPI.Builder
host(String host)
Initializes the value for thehost
attribute.RemoteAPI.Builder
path(String path)
Initializes the optional valuepath
to path.RemoteAPI.Builder
path(Optional<String> path)
Initializes the optional valuepath
to path.RemoteAPI.Builder
port(int port)
Initializes the value for theport
attribute.RemoteAPI.Builder
protocol(String protocol)
Initializes the value for theprotocol
attribute.
-
-
-
Method Detail
-
from
public final RemoteAPI.Builder from(RemoteAPI instance)
Fill a builder with attribute values from the providedcom.github.m0nk3y2k4.thetvdb.internal.connection.RemoteAPI
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder 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.Proxy
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
path
public final RemoteAPI.Builder path(String path)
Initializes the optional valuepath
to path.- Parameters:
path
- The value for path- Returns:
this
builder for chained invocation
-
path
public final RemoteAPI.Builder path(Optional<String> path)
Initializes the optional valuepath
to path.- Parameters:
path
- The value for path- Returns:
this
builder for use in a chained invocation
-
protocol
public final RemoteAPI.Builder protocol(String protocol)
Initializes the value for theprotocol
attribute.If not set, this attribute will have a default value as returned by the initializer of
protocol
.- Parameters:
protocol
- The value for protocol- Returns:
this
builder for use in a chained invocation
-
host
public final RemoteAPI.Builder host(String host)
Initializes the value for thehost
attribute.If not set, this attribute will have a default value as returned by the initializer of
host
.- Parameters:
host
- The value for host- Returns:
this
builder for use in a chained invocation
-
port
public final RemoteAPI.Builder port(int port)
Initializes the value for theport
attribute.If not set, this attribute will have a default value as returned by the initializer of
port
.- Parameters:
port
- The value for port- Returns:
this
builder 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
-
-