Package com.spotify.github.http
Class ImmutableLink.Builder
- java.lang.Object
-
- com.spotify.github.http.ImmutableLink.Builder
-
- Enclosing class:
- ImmutableLink
@NotThreadSafe public static final class ImmutableLink.Builder extends Object
Builds instances of typeImmutableLink. 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 ImmutableLink.Builderanchor(String anchor)Initializes the optional valueanchorto anchor.ImmutableLink.Builderanchor(Optional<String> anchor)Initializes the optional valueanchorto anchor.ImmutableLinkbuild()Builds a newImmutableLink.ImmutableLink.Builderfrom(Link instance)Fill a builder with attribute values from the providedLinkinstance.ImmutableLink.Buildermedia(String media)Initializes the optional valuemediato media.ImmutableLink.Buildermedia(Optional<String> media)Initializes the optional valuemediato media.ImmutableLink.Builderrel(String rel)Initializes the optional valuerelto rel.ImmutableLink.Builderrel(Optional<String> rel)Initializes the optional valuerelto rel.ImmutableLink.Builderrev(String rev)Initializes the optional valuerevto rev.ImmutableLink.Builderrev(Optional<String> rev)Initializes the optional valuerevto rev.ImmutableLink.Buildertitle(String title)Initializes the optional valuetitleto title.ImmutableLink.Buildertitle(Optional<String> title)Initializes the optional valuetitleto title.ImmutableLink.Buildertype(String type)Initializes the optional valuetypeto type.ImmutableLink.Buildertype(Optional<String> type)Initializes the optional valuetypeto type.ImmutableLink.Builderurl(URI url)Initializes the value for theurlattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableLink.Builder from(Link instance)
Fill a builder with attribute values from the providedLinkinstance. 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
-
url
@CanIgnoreReturnValue public final ImmutableLink.Builder url(URI url)
Initializes the value for theurlattribute.- Parameters:
url- The value for url- Returns:
thisbuilder for use in a chained invocation
-
rel
@CanIgnoreReturnValue public final ImmutableLink.Builder rel(String rel)
Initializes the optional valuerelto rel.- Parameters:
rel- The value for rel- Returns:
thisbuilder for chained invocation
-
rel
@CanIgnoreReturnValue public final ImmutableLink.Builder rel(Optional<String> rel)
Initializes the optional valuerelto rel.- Parameters:
rel- The value for rel- Returns:
thisbuilder for use in a chained invocation
-
rev
@CanIgnoreReturnValue public final ImmutableLink.Builder rev(String rev)
Initializes the optional valuerevto rev.- Parameters:
rev- The value for rev- Returns:
thisbuilder for chained invocation
-
rev
@CanIgnoreReturnValue public final ImmutableLink.Builder rev(Optional<String> rev)
Initializes the optional valuerevto rev.- Parameters:
rev- The value for rev- Returns:
thisbuilder for use in a chained invocation
-
type
@CanIgnoreReturnValue public final ImmutableLink.Builder type(String type)
Initializes the optional valuetypeto type.- Parameters:
type- The value for type- Returns:
thisbuilder for chained invocation
-
type
@CanIgnoreReturnValue public final ImmutableLink.Builder type(Optional<String> type)
Initializes the optional valuetypeto type.- Parameters:
type- The value for type- Returns:
thisbuilder for use in a chained invocation
-
media
@CanIgnoreReturnValue public final ImmutableLink.Builder media(String media)
Initializes the optional valuemediato media.- Parameters:
media- The value for media- Returns:
thisbuilder for chained invocation
-
media
@CanIgnoreReturnValue public final ImmutableLink.Builder media(Optional<String> media)
Initializes the optional valuemediato media.- Parameters:
media- The value for media- Returns:
thisbuilder for use in a chained invocation
-
title
@CanIgnoreReturnValue public final ImmutableLink.Builder title(String title)
Initializes the optional valuetitleto title.- Parameters:
title- The value for title- Returns:
thisbuilder for chained invocation
-
title
@CanIgnoreReturnValue public final ImmutableLink.Builder title(Optional<String> title)
Initializes the optional valuetitleto title.- Parameters:
title- The value for title- Returns:
thisbuilder for use in a chained invocation
-
anchor
@CanIgnoreReturnValue public final ImmutableLink.Builder anchor(String anchor)
Initializes the optional valueanchorto anchor.- Parameters:
anchor- The value for anchor- Returns:
thisbuilder for chained invocation
-
anchor
@CanIgnoreReturnValue public final ImmutableLink.Builder anchor(Optional<String> anchor)
Initializes the optional valueanchorto anchor.- Parameters:
anchor- The value for anchor- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableLink build()
Builds a newImmutableLink.- Returns:
- An immutable instance of Link
- Throws:
IllegalStateException- if any required attributes are missing
-
-