public class

Link

extends Element
implements ILink
java.lang.Object
   ↳ com.google.gdata.model.Element
     ↳ com.google.gdata.model.atom.Link

Class Overview

Class representing atom:link.

Summary

Fields
public static final AttributeKey<String> ETAG The etag attribute.
public static final AttributeKey<String> HREF The href attribute.
public static final AttributeKey<String> HREFLANG The hreflang attribute.
public static final ElementKey<Void, Link> KEY The key for this element.
public static final AttributeKey<Long> LENGTH The length attribute.
public static final AttributeKey<String> REL The rel attribute.
public static final AttributeKey<String> TITLE The title attribute.
public static final AttributeKey<String> TYPE The type attribute.
public static final AttributeKey<String> XML_LANG The xml:lang attribute.
protected long length Length of the resource pointed to by href, in bytes.
[Expand]
Inherited Fields
From class com.google.gdata.model.Element
Public Constructors
Link()
Constructs a new instance using the default metadata.
Link(String rel, String type, String href)
This constructor is deprecated. Use Link(String, String, URI) instead.
Link(String rel, String type, URI href)
Constructs a new instance using the default metadata, and setting the links rel, type, and href attributes.
Protected Constructors
Link(ElementKey<?, ? extends Link> key)
Constructs a new instance using the specified element metadata.
Link(ElementKey<?, ? extends Link> key, Element source)
Constructs a new instance by doing a shallow copy of data from an existing Element instance.
Public Methods
Content getContent()
Return the content of the link, or null if no content has been set.
String getEtag()
Etag of linked resource or null if unknown.
String getHref()
Link URI.
String getHrefLang()
Language of resource pointed to by href.
URI getHrefUri()
long getLength()
String getRel()
Link relation type.
String getTitle()
Link title.
String getTitleLang()
Language of link title.
String getType()
MIME type of the link target.
boolean matches(String relToMatch, String typeToMatch)
Returns whether this link matches the given rel and type values.
static void registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.
void setContent(Content c)
Sets the atom:content element nested inside this atom:link.
void setEtag(String v)
void setHref(URI v)
void setHref(String v)
Sets the value of the resource reference.
void setHrefLang(String v)
void setLength(long v)
void setRel(String v)
Sets the link relation type.
void setTitle(String v)
void setTitleLang(String v)
void setType(String v)
Sets the mime type of the link.
Protected Methods
Element narrow(ElementMetadata<?, ?> meta, ValidationContext vc)
Narrow down element's type to the most specific one possible.
[Expand]
Inherited Methods
From class com.google.gdata.model.Element
From class java.lang.Object
From interface com.google.gdata.data.ILink
From interface com.google.gdata.data.Reference

Fields

public static final AttributeKey<String> ETAG

The etag attribute.

public static final AttributeKey<String> HREF

The href attribute.

public static final AttributeKey<String> HREFLANG

The hreflang attribute.

public static final ElementKey<Void, Link> KEY

The key for this element.

public static final AttributeKey<Long> LENGTH

The length attribute.

public static final AttributeKey<String> REL

The rel attribute.

public static final AttributeKey<String> TITLE

The title attribute.

public static final AttributeKey<String> TYPE

The type attribute.

public static final AttributeKey<String> XML_LANG

The xml:lang attribute.

protected long length

Length of the resource pointed to by href, in bytes.

Public Constructors

public Link ()

Constructs a new instance using the default metadata.

public Link (String rel, String type, String href)

This constructor is deprecated.
Use Link(String, String, URI) instead.

Constructs a new instance using the default metadata, and setting the links rel, type, and href attributes.

Parameters
rel
type
href

public Link (String rel, String type, URI href)

Constructs a new instance using the default metadata, and setting the links rel, type, and href attributes.

Parameters
rel
type
href

Protected Constructors

protected Link (ElementKey<?, ? extends Link> key)

Constructs a new instance using the specified element metadata.

Parameters
key The element key for this link.

protected Link (ElementKey<?, ? extends Link> key, Element source)

Constructs a new instance by doing a shallow copy of data from an existing Element instance. Will use the given ElementMetadata as the metadata for the element.

Parameters
key The element key to use for this element.
source Source element

Public Methods

public Content getContent ()

Return the content of the link, or null if no content has been set. This is used to inline an atom:content element inside an atom:link element.

Returns
  • the atom:content element, or null if none exists.

public String getEtag ()

Etag of linked resource or null if unknown.

public String getHref ()

Link URI.

public String getHrefLang ()

Language of resource pointed to by href.

public URI getHrefUri ()

public long getLength ()

public String getRel ()

Link relation type. Possible values include self, prev, next, enclosure, etc.

public String getTitle ()

Link title.

public String getTitleLang ()

Language of link title.

public String getType ()

MIME type of the link target.

public boolean matches (String relToMatch, String typeToMatch)

Returns whether this link matches the given rel and type values.

Parameters
relToMatch rel value to match or null to match any rel value.
typeToMatch type value to match or null to match any type value.

public static void registerMetadata (MetadataRegistry registry)

Registers the metadata for this element.

Parameters
registry

public void setContent (Content c)

Sets the atom:content element nested inside this atom:link.

Parameters
c The content to place inside the link.

public void setEtag (String v)

Parameters
v

public void setHref (URI v)

Parameters
v

public void setHref (String v)

Sets the value of the resource reference.

Parameters
v The resource href.

public void setHrefLang (String v)

Parameters
v

public void setLength (long v)

Parameters
v

public void setRel (String v)

Sets the link relation type.

Parameters
v

public void setTitle (String v)

Parameters
v

public void setTitleLang (String v)

Parameters
v

public void setType (String v)

Sets the mime type of the link.

Parameters
v

Protected Methods

protected Element narrow (ElementMetadata<?, ?> meta, ValidationContext vc)

Narrow down element's type to the most specific one possible.

Any validation errors discovered during narrowing are accumulated in the validation context.

Default action is to not do anything with current element. Subclasses may override this function to narrow the type in some custom fashion.

Parameters
meta The element metadata to narrow to.
vc Validation context
Returns
  • element narrowed down to the most specific type