Google Data APIs Client Library



com.google.gdata.data
Class Link

java.lang.Object
  extended by com.google.gdata.data.AbstractExtension
      extended by com.google.gdata.data.ExtensionPoint
          extended by com.google.gdata.data.Link
All Implemented Interfaces:
Extension, Reference
Direct Known Subclasses:
EntryLink, FeedLink

public class Link
extends ExtensionPoint
implements Reference

External link type.


Nested Class Summary
 class Link.AtomHandler
          <atom:link> parser.
static class Link.Rel
          The Rel class defines constants for some common link relation types.
static class Link.Type
          The Type class contains several common link content types.
 
Nested classes/interfaces inherited from class com.google.gdata.data.ExtensionPoint
ExtensionPoint.CumulativeBlobHandler, ExtensionPoint.ExtensionHandler
 
Nested classes/interfaces inherited from class com.google.gdata.data.AbstractExtension
AbstractExtension.AttributesHandler
 
Field Summary
protected  java.lang.String href
          Link URI.
protected  java.lang.String hrefLang
          Language of resource pointed to by href.
protected  long length
          Length of the resource pointed to by href, in bytes.
protected  java.lang.String rel
          Link relation type.
protected  java.lang.String title
          Link title.
protected  java.lang.String titleLang
          Language of link title.
protected  java.lang.String type
          MIME type of the link target.
 
Fields inherited from class com.google.gdata.data.ExtensionPoint
xmlBlob
 
Fields inherited from class com.google.gdata.data.AbstractExtension
localName, namespace
 
Constructor Summary
Link()
           
Link(java.lang.String rel, java.lang.String type, java.lang.String href)
           
 
Method Summary
 void generateAtom(com.google.gdata.util.common.xml.XmlWriter w, ExtensionProfile extProfile)
          Generates XML in the Atom format.
 void generateRss(com.google.gdata.util.common.xml.XmlWriter w)
          Generates XML in the RSS format.
 java.lang.String getHref()
          Returns the value of the resource reference.
 java.lang.String getHrefLang()
           
 long getLength()
           
 java.lang.String getRel()
           
 java.lang.String getTitle()
           
 java.lang.String getTitleLang()
           
 java.lang.String getType()
          Returns the MIME type of the referenced resource (or null if unknown).
 boolean matches(java.lang.String relToMatch, java.lang.String typeToMatch)
          Returns whether this link matches the given rel and type values.
 void setHref(java.lang.String v)
          Sets the value of the resource reference.
 void setHrefLang(java.lang.String v)
           
 void setLength(long v)
           
 void setRel(java.lang.String v)
           
 void setTitle(java.lang.String v)
           
 void setTitleLang(java.lang.String v)
           
 void setType(java.lang.String v)
           
 
Methods inherited from class com.google.gdata.data.ExtensionPoint
addExtension, addExtension, addRepeatingExtension, addRepeatingExtension, checkRequiredExtensions, declareExtensions, generate, generateCumulativeXmlBlob, generateExtensions, generateStartElement, getExtension, getExtensionHandler, getExtensions, getHandler, getManifest, getRepeatingExtension, getRepeatingExtensions, getXmlBlob, hasExtension, hasRepeatingExtension, initializeArbitraryXml, parseCumulativeXmlBlob, removeExtension, removeExtension, removeRepeatingExtension, setExtension, setXmlBlob, visit, visitChild, visitChildren
 
Methods inherited from class com.google.gdata.data.AbstractExtension
consumeAttributes, eq, generate, isImmutable, putAttributes, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rel

protected java.lang.String rel
Link relation type. Possible values include self, prev, next, enclosure, etc.


type

protected java.lang.String type
MIME type of the link target.


href

protected java.lang.String href
Link URI.


hrefLang

protected java.lang.String hrefLang
Language of resource pointed to by href.


title

protected java.lang.String title
Link title.


titleLang

protected java.lang.String titleLang
Language of link title.


length

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

Constructor Detail

Link

public Link()

Link

public Link(java.lang.String rel,
            java.lang.String type,
            java.lang.String href)
Method Detail

getRel

public java.lang.String getRel()

setRel

public void setRel(java.lang.String v)

getType

public java.lang.String getType()
Description copied from interface: Reference
Returns the MIME type of the referenced resource (or null if unknown).

Specified by:
getType in interface Reference

setType

public void setType(java.lang.String v)

getHref

public java.lang.String getHref()
Description copied from interface: Reference
Returns the value of the resource reference.

Specified by:
getHref in interface Reference

setHref

public void setHref(java.lang.String v)
Description copied from interface: Reference
Sets the value of the resource reference.

Specified by:
setHref in interface Reference
Parameters:
v - the resource href.

getHrefLang

public java.lang.String getHrefLang()

setHrefLang

public void setHrefLang(java.lang.String v)

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String v)

getTitleLang

public java.lang.String getTitleLang()

setTitleLang

public void setTitleLang(java.lang.String v)

getLength

public long getLength()

setLength

public void setLength(long v)

matches

public boolean matches(java.lang.String relToMatch,
                       java.lang.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.

generateAtom

public void generateAtom(com.google.gdata.util.common.xml.XmlWriter w,
                         ExtensionProfile extProfile)
                  throws java.io.IOException
Generates XML in the Atom format.

Parameters:
w - Output writer.
extProfile - Extension profile.
Throws:
java.io.IOException

generateRss

public void generateRss(com.google.gdata.util.common.xml.XmlWriter w)
                 throws java.io.IOException
Generates XML in the RSS format.

Parameters:
w - Output writer.
Throws:
java.io.IOException