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.Builder
is 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.Builder
anchor(String anchor)
Initializes the optional valueanchor
to anchor.ImmutableLink.Builder
anchor(Optional<String> anchor)
Initializes the optional valueanchor
to anchor.ImmutableLink
build()
Builds a newImmutableLink
.ImmutableLink.Builder
from(Link instance)
Fill a builder with attribute values from the providedLink
instance.ImmutableLink.Builder
media(String media)
Initializes the optional valuemedia
to media.ImmutableLink.Builder
media(Optional<String> media)
Initializes the optional valuemedia
to media.ImmutableLink.Builder
rel(String rel)
Initializes the optional valuerel
to rel.ImmutableLink.Builder
rel(Optional<String> rel)
Initializes the optional valuerel
to rel.ImmutableLink.Builder
rev(String rev)
Initializes the optional valuerev
to rev.ImmutableLink.Builder
rev(Optional<String> rev)
Initializes the optional valuerev
to rev.ImmutableLink.Builder
title(String title)
Initializes the optional valuetitle
to title.ImmutableLink.Builder
title(Optional<String> title)
Initializes the optional valuetitle
to title.ImmutableLink.Builder
type(String type)
Initializes the optional valuetype
to type.ImmutableLink.Builder
type(Optional<String> type)
Initializes the optional valuetype
to type.ImmutableLink.Builder
url(URI url)
Initializes the value for theurl
attribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableLink.Builder from(Link instance)
Fill a builder with attribute values from the providedLink
instance. 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:
this
builder for use in a chained invocation
-
url
@CanIgnoreReturnValue public final ImmutableLink.Builder url(URI url)
Initializes the value for theurl
attribute.- Parameters:
url
- The value for url- Returns:
this
builder for use in a chained invocation
-
rel
@CanIgnoreReturnValue public final ImmutableLink.Builder rel(String rel)
Initializes the optional valuerel
to rel.- Parameters:
rel
- The value for rel- Returns:
this
builder for chained invocation
-
rel
@CanIgnoreReturnValue public final ImmutableLink.Builder rel(Optional<String> rel)
Initializes the optional valuerel
to rel.- Parameters:
rel
- The value for rel- Returns:
this
builder for use in a chained invocation
-
rev
@CanIgnoreReturnValue public final ImmutableLink.Builder rev(String rev)
Initializes the optional valuerev
to rev.- Parameters:
rev
- The value for rev- Returns:
this
builder for chained invocation
-
rev
@CanIgnoreReturnValue public final ImmutableLink.Builder rev(Optional<String> rev)
Initializes the optional valuerev
to rev.- Parameters:
rev
- The value for rev- Returns:
this
builder for use in a chained invocation
-
type
@CanIgnoreReturnValue public final ImmutableLink.Builder type(String type)
Initializes the optional valuetype
to type.- Parameters:
type
- The value for type- Returns:
this
builder for chained invocation
-
type
@CanIgnoreReturnValue public final ImmutableLink.Builder type(Optional<String> type)
Initializes the optional valuetype
to type.- Parameters:
type
- The value for type- Returns:
this
builder for use in a chained invocation
-
media
@CanIgnoreReturnValue public final ImmutableLink.Builder media(String media)
Initializes the optional valuemedia
to media.- Parameters:
media
- The value for media- Returns:
this
builder for chained invocation
-
media
@CanIgnoreReturnValue public final ImmutableLink.Builder media(Optional<String> media)
Initializes the optional valuemedia
to media.- Parameters:
media
- The value for media- Returns:
this
builder for use in a chained invocation
-
title
@CanIgnoreReturnValue public final ImmutableLink.Builder title(String title)
Initializes the optional valuetitle
to title.- Parameters:
title
- The value for title- Returns:
this
builder for chained invocation
-
title
@CanIgnoreReturnValue public final ImmutableLink.Builder title(Optional<String> title)
Initializes the optional valuetitle
to title.- Parameters:
title
- The value for title- Returns:
this
builder for use in a chained invocation
-
anchor
@CanIgnoreReturnValue public final ImmutableLink.Builder anchor(String anchor)
Initializes the optional valueanchor
to anchor.- Parameters:
anchor
- The value for anchor- Returns:
this
builder for chained invocation
-
anchor
@CanIgnoreReturnValue public final ImmutableLink.Builder anchor(Optional<String> anchor)
Initializes the optional valueanchor
to anchor.- Parameters:
anchor
- The value for anchor- Returns:
this
builder 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
-
-