Package com.spotify.github.http
Class ImmutableLink
- java.lang.Object
-
- com.spotify.github.http.ImmutableLink
-
- All Implemented Interfaces:
Link
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableLink extends Object implements Link
Immutable implementation ofLink
.Use the builder to create immutable instances:
ImmutableLink.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableLink.Builder
Builds instances of typeImmutableLink
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>
anchor()
When present, the anchor parameter overrides this with another URI, such as a fragment of this resource, or a third resource (i.e., when the anchor value is an absolute URI).static ImmutableLink.Builder
builder()
Creates a builder forImmutableLink
.static ImmutableLink
copyOf(Link instance)
Creates an immutable copy of aLink
value.boolean
equals(Object another)
This instance is equal to all instances ofImmutableLink
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:url
,rel
,rev
,type
,media
,title
,anchor
.Optional<String>
media()
The "media" parameter, when present, is used to indicate intended destination medium or media for style information (see [W3C.REC-html401-19991224], Section 6.13).Optional<String>
rel()
The relation type of a link is conveyed in the "rel" parameter's value.Optional<String>
rev()
The "rev" parameter has been used in the past to indicate that the semantics of the relationship are in the reverse direction.Optional<String>
title()
The "title" parameter, when present, is used to label the destination of a link such that it can be used as a human-readable identifier (e.g., a menu entry) in the language indicated by the Content- Language header (if present).String
toString()
Prints the immutable valueLink
with attribute values.Optional<String>
type()
The "type" parameter, when present, is a hint indicating what the media type of the result of dereferencing the link should be.URI
url()
Link value.ImmutableLink
withAnchor(String value)
Copy the current immutable object by setting a present value for the optionalanchor
attribute.ImmutableLink
withAnchor(Optional<String> optional)
Copy the current immutable object by setting an optional value for theanchor
attribute.ImmutableLink
withMedia(String value)
Copy the current immutable object by setting a present value for the optionalmedia
attribute.ImmutableLink
withMedia(Optional<String> optional)
Copy the current immutable object by setting an optional value for themedia
attribute.ImmutableLink
withRel(String value)
Copy the current immutable object by setting a present value for the optionalrel
attribute.ImmutableLink
withRel(Optional<String> optional)
Copy the current immutable object by setting an optional value for therel
attribute.ImmutableLink
withRev(String value)
Copy the current immutable object by setting a present value for the optionalrev
attribute.ImmutableLink
withRev(Optional<String> optional)
Copy the current immutable object by setting an optional value for therev
attribute.ImmutableLink
withTitle(String value)
Copy the current immutable object by setting a present value for the optionaltitle
attribute.ImmutableLink
withTitle(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetitle
attribute.ImmutableLink
withType(String value)
Copy the current immutable object by setting a present value for the optionaltype
attribute.ImmutableLink
withType(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetype
attribute.ImmutableLink
withUrl(URI value)
Copy the current immutable object by setting a value for theurl
attribute.
-
-
-
Method Detail
-
rel
public Optional<String> rel()
The relation type of a link is conveyed in the "rel" parameter's value. The "rel" parameter MUST NOT appear more than once in a given link-value; occurrences after the first MUST be ignored by parsers.
-
rev
public Optional<String> rev()
The "rev" parameter has been used in the past to indicate that the semantics of the relationship are in the reverse direction. That is, a link from A to B with REL="X" expresses the same relationship as a link from B to A with REV="X". "rev" is deprecated by this specification because it often confuses authors and readers; in most cases, using a separate relation type is preferable.
-
type
public Optional<String> type()
The "type" parameter, when present, is a hint indicating what the media type of the result of dereferencing the link should be. Note that this is only a hint; for example, it does not override the Content-Type header of a HTTP response obtained by actually following the link. There MUST NOT be more than one type parameter in a link- value.
-
media
public Optional<String> media()
The "media" parameter, when present, is used to indicate intended destination medium or media for style information (see [W3C.REC-html401-19991224], Section 6.13). Note that this may be updated by [W3C.CR-css3-mediaqueries-20090915]). Its value MUST be quoted if it contains a semicolon (";") or comma (","), and there MUST NOT be more than one "media" parameter in a link-value.
-
title
public Optional<String> title()
The "title" parameter, when present, is used to label the destination of a link such that it can be used as a human-readable identifier (e.g., a menu entry) in the language indicated by the Content- Language header (if present). The "title" parameter MUST NOT appear more than once in a given link-value; occurrences after the first MUST be ignored by parsers.
-
anchor
public Optional<String> anchor()
When present, the anchor parameter overrides this with another URI, such as a fragment of this resource, or a third resource (i.e., when the anchor value is an absolute URI).
-
withUrl
public final ImmutableLink withUrl(URI value)
Copy the current immutable object by setting a value for theurl
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for url- Returns:
- A modified copy of the
this
object
-
withRel
public final ImmutableLink withRel(String value)
Copy the current immutable object by setting a present value for the optionalrel
attribute.- Parameters:
value
- The value for rel- Returns:
- A modified copy of
this
object
-
withRel
public final ImmutableLink withRel(Optional<String> optional)
Copy the current immutable object by setting an optional value for therel
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for rel- Returns:
- A modified copy of
this
object
-
withRev
public final ImmutableLink withRev(String value)
Copy the current immutable object by setting a present value for the optionalrev
attribute.- Parameters:
value
- The value for rev- Returns:
- A modified copy of
this
object
-
withRev
public final ImmutableLink withRev(Optional<String> optional)
Copy the current immutable object by setting an optional value for therev
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for rev- Returns:
- A modified copy of
this
object
-
withType
public final ImmutableLink withType(String value)
Copy the current immutable object by setting a present value for the optionaltype
attribute.- Parameters:
value
- The value for type- Returns:
- A modified copy of
this
object
-
withType
public final ImmutableLink withType(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetype
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for type- Returns:
- A modified copy of
this
object
-
withMedia
public final ImmutableLink withMedia(String value)
Copy the current immutable object by setting a present value for the optionalmedia
attribute.- Parameters:
value
- The value for media- Returns:
- A modified copy of
this
object
-
withMedia
public final ImmutableLink withMedia(Optional<String> optional)
Copy the current immutable object by setting an optional value for themedia
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for media- Returns:
- A modified copy of
this
object
-
withTitle
public final ImmutableLink withTitle(String value)
Copy the current immutable object by setting a present value for the optionaltitle
attribute.- Parameters:
value
- The value for title- Returns:
- A modified copy of
this
object
-
withTitle
public final ImmutableLink withTitle(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetitle
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for title- Returns:
- A modified copy of
this
object
-
withAnchor
public final ImmutableLink withAnchor(String value)
Copy the current immutable object by setting a present value for the optionalanchor
attribute.- Parameters:
value
- The value for anchor- Returns:
- A modified copy of
this
object
-
withAnchor
public final ImmutableLink withAnchor(Optional<String> optional)
Copy the current immutable object by setting an optional value for theanchor
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for anchor- Returns:
- A modified copy of
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableLink
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:url
,rel
,rev
,type
,media
,title
,anchor
.
-
toString
public String toString()
Prints the immutable valueLink
with attribute values.
-
copyOf
public static ImmutableLink copyOf(Link instance)
Creates an immutable copy of aLink
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable Link instance
-
builder
public static ImmutableLink.Builder builder()
Creates a builder forImmutableLink
.ImmutableLink.builder() .url(java.net.URI) // required
url
.rel(String) // optionalrel
.rev(String) // optionalrev
.type(String) // optionaltype
.media(String) // optionalmedia
.title(String) // optionaltitle
.anchor(String) // optionalanchor
.build();- Returns:
- A new ImmutableLink builder
-
-