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 classImmutableLink.BuilderBuilds 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.Builderbuilder()Creates a builder forImmutableLink.static ImmutableLinkcopyOf(Link instance)Creates an immutable copy of aLinkvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableLinkthat have equal attribute values.inthashCode()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).StringtoString()Prints the immutable valueLinkwith 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.URIurl()Link value.ImmutableLinkwithAnchor(String value)Copy the current immutable object by setting a present value for the optionalanchorattribute.ImmutableLinkwithAnchor(Optional<String> optional)Copy the current immutable object by setting an optional value for theanchorattribute.ImmutableLinkwithMedia(String value)Copy the current immutable object by setting a present value for the optionalmediaattribute.ImmutableLinkwithMedia(Optional<String> optional)Copy the current immutable object by setting an optional value for themediaattribute.ImmutableLinkwithRel(String value)Copy the current immutable object by setting a present value for the optionalrelattribute.ImmutableLinkwithRel(Optional<String> optional)Copy the current immutable object by setting an optional value for therelattribute.ImmutableLinkwithRev(String value)Copy the current immutable object by setting a present value for the optionalrevattribute.ImmutableLinkwithRev(Optional<String> optional)Copy the current immutable object by setting an optional value for therevattribute.ImmutableLinkwithTitle(String value)Copy the current immutable object by setting a present value for the optionaltitleattribute.ImmutableLinkwithTitle(Optional<String> optional)Copy the current immutable object by setting an optional value for thetitleattribute.ImmutableLinkwithType(String value)Copy the current immutable object by setting a present value for the optionaltypeattribute.ImmutableLinkwithType(Optional<String> optional)Copy the current immutable object by setting an optional value for thetypeattribute.ImmutableLinkwithUrl(URI value)Copy the current immutable object by setting a value for theurlattribute.
-
-
-
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 theurlattribute. 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
thisobject
-
withRel
public final ImmutableLink withRel(String value)
Copy the current immutable object by setting a present value for the optionalrelattribute.- Parameters:
value- The value for rel- Returns:
- A modified copy of
thisobject
-
withRel
public final ImmutableLink withRel(Optional<String> optional)
Copy the current immutable object by setting an optional value for therelattribute. 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
thisobject
-
withRev
public final ImmutableLink withRev(String value)
Copy the current immutable object by setting a present value for the optionalrevattribute.- Parameters:
value- The value for rev- Returns:
- A modified copy of
thisobject
-
withRev
public final ImmutableLink withRev(Optional<String> optional)
Copy the current immutable object by setting an optional value for therevattribute. 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
thisobject
-
withType
public final ImmutableLink withType(String value)
Copy the current immutable object by setting a present value for the optionaltypeattribute.- Parameters:
value- The value for type- Returns:
- A modified copy of
thisobject
-
withType
public final ImmutableLink withType(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetypeattribute. 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
thisobject
-
withMedia
public final ImmutableLink withMedia(String value)
Copy the current immutable object by setting a present value for the optionalmediaattribute.- Parameters:
value- The value for media- Returns:
- A modified copy of
thisobject
-
withMedia
public final ImmutableLink withMedia(Optional<String> optional)
Copy the current immutable object by setting an optional value for themediaattribute. 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
thisobject
-
withTitle
public final ImmutableLink withTitle(String value)
Copy the current immutable object by setting a present value for the optionaltitleattribute.- Parameters:
value- The value for title- Returns:
- A modified copy of
thisobject
-
withTitle
public final ImmutableLink withTitle(Optional<String> optional)
Copy the current immutable object by setting an optional value for thetitleattribute. 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
thisobject
-
withAnchor
public final ImmutableLink withAnchor(String value)
Copy the current immutable object by setting a present value for the optionalanchorattribute.- Parameters:
value- The value for anchor- Returns:
- A modified copy of
thisobject
-
withAnchor
public final ImmutableLink withAnchor(Optional<String> optional)
Copy the current immutable object by setting an optional value for theanchorattribute. 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
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableLinkthat 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 valueLinkwith attribute values.
-
copyOf
public static ImmutableLink copyOf(Link instance)
Creates an immutable copy of aLinkvalue. 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) // requiredurl.rel(String) // optionalrel.rev(String) // optionalrev.type(String) // optionaltype.media(String) // optionalmedia.title(String) // optionaltitle.anchor(String) // optionalanchor.build();- Returns:
- A new ImmutableLink builder
-
-