Class Link
Atom links define references to related resources such as alternate representations, related documents, enclosures (for podcasts), and navigation links. Links are one of the fundamental components of Atom and enable rich hypermedia relationships between resources.
The link's
alternate - An alternate representation (e.g., HTML version of entry)self - The feed/entry itselfrelated - A related resourceenclosure - A related resource to be downloaded (e.g., podcast audio)via - The source of the information
Schema
atomLink = element atom:link { atomCommonAttributes, attribute href { atomUri }, attribute rel { atomNCName | atomUri }?, attribute type { atomMediaType }?, attribute hreflang { atomLanguageTag }?, attribute title { text }?, attribute length { text }?, undefinedContent }
Example:
Specification:
Represents an
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHref()
Bean property getter:href .Bean property getter:hreflang .Bean property getter:length .getRel()
Bean property getter:rel .getTitle()
Bean property getter:title .getType()
Bean property getter:type .Bean property setter:base .Bean property setter:href .setHreflang
(String value) Bean property setter:hreflang .Bean property setter:lang .Bean property setter:length .Bean property setter:rel .Bean property setter:title .Bean property setter:type .
-
Constructor Details
-
Link
Normal constructor.- Parameters:
rel
- The rel of the link.type
- The type of the link.href
- The URI of the link.
-
Link
public Link()Bean constructor.
-
-
Method Details
-
getHref
Bean property getter:href .Returns the URI of the referenced resource.
This is the target address of the link and is a required attribute for all Atom links.
- Returns:
- The property value, or
null if it is not set.
-
setHref
Bean property setter:href .Sets the URI of the referenced resource (required).
Example:
Link
link =new Link() .setHref("http://example.org/posts/1" );- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
getRel
Bean property getter:rel .Returns the link relation type.
The
rel attribute indicates the type of relationship between the entry/feed and the linked resource. When not specified, the default is "alternate".- Returns:
- The property value, or
null if it is not set.
-
setRel
Bean property setter:rel .Sets the link relation type.
Common values include
"alternate" ,"self" ,"related" ,"enclosure" ,"via" ,"first" ,"last" ,"previous" ,"next" .Example:
Link
link =new Link() .setRel("alternate" ) .setHref("http://example.org/post1.html" );- Parameters:
value
- The new value for this property.
Can benull to unset the property (defaults to "alternate").- Returns:
- This object.
-
getType
Bean property getter:type .The content type of the target of this link.
- Returns:
- The property value, or
null if it is not set.
-
setType
Bean property setter:type .The content type of the target of this link.
This should be a valid MIME media type as defined by RFC 4287.
Examples:
"text/html" "application/pdf" "image/jpeg" "application/atom+xml"
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getHreflang
Bean property getter:hreflang .Returns the language of the resource pointed to by the link.
The value should be a language tag as defined by RFC 3066.
- Returns:
- The property value, or
null if it is not set.
-
setHreflang
Bean property setter:hreflang .Sets the language of the resource pointed to by the link.
Example:
Link
link =new Link("alternate" ,"text/html" ,"http://example.org/post1.html" ) .setHreflang("en-US" );- Parameters:
value
- The new value for this property (e.g., "en", "fr", "de", "en-US").
Can benull to unset the property.- Returns:
- This object.
-
getTitle
Bean property getter:title .Returns human-readable information about the link.
The title provides advisory information about the link, typically for display to users.
- Returns:
- The property value, or
null if it is not set.
-
setTitle
Bean property setter:title .Sets human-readable information about the link.
Example:
Link
link =new Link("related" ,"text/html" ,"http://example.org/related" ) .setTitle("Related Article" );- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
getLength
Bean property getter:length .Returns an advisory size in bytes of the linked resource.
This is particularly useful for enclosures (podcast episodes, video files, etc.) to help clients decide whether to download the resource.
- Returns:
- The property value, or
null if it is not set.
-
setLength
Bean property setter:length .Sets an advisory size in bytes of the linked resource.
Example:
// Podcast episode with file size Linklink =new Link("enclosure" ,"audio/mpeg" ,"http://example.org/episode1.mp3" ) .setLength(24986239);// ~24 MB - Parameters:
value
- The new value for this property in bytes.
Can benull to unset the property.- Returns:
- This object.
-
setBase
Description copied from class:Common
-
setLang
Description copied from class:Common
Bean property setter:lang .Sets the natural language of the element's content (xml:lang attribute).
Example:
Text
title =new Text("text" ) .setText("Mon Blog" ) .setLang("fr" );
-