Google Data APIs Client Library (1.41.1)



com.google.gdata.data.geo.impl
Class W3CPoint

java.lang.Object
  extended by com.google.gdata.data.AbstractExtension
      extended by com.google.gdata.data.ExtensionPoint
          extended by com.google.gdata.data.geo.impl.W3CPoint
All Implemented Interfaces:
Extension, Point

public class W3CPoint
extends ExtensionPoint
implements Point

Extension for a W3C geo:Point element. It contains the getter/setter for specifying the longitude and latitude of a geo-coordinate. Please see the W3C document http://www.w3.org/2003/01/geo for more information.


Nested Class Summary
protected  class W3CPoint.Handler
          Simple delegating handler implementation that uses (only) ExtensionProfile linkages for child element lookup.
 
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
 
Fields inherited from class com.google.gdata.data.ExtensionPoint
xmlBlob
 
Fields inherited from class com.google.gdata.data.AbstractExtension
localName, namespace
 
Constructor Summary
W3CPoint()
          Constructs an empty geo:Point element.
W3CPoint(java.lang.Double lat, java.lang.Double lon)
          Constructs a geo:Point element with child geo:lat and geo:long elements based on the parameters passed in.
W3CPoint(Point copyFrom)
          Constructs a geo:Point element copying the lat and lon values from the given point.
 
Method Summary
 void declareExtensions(ExtensionProfile extProfile)
          Declares the set of expected Extension types for an ExtensionPoint within the target extension profile.
 void generate(com.google.gdata.util.common.xml.XmlWriter w, ExtensionProfile extProfile)
          Generates the XML corresponding to this GeoPoint.
static ExtensionDescription getDefaultDescription()
          Returns the suggested extension description and is repeatable.
static ExtensionDescription getDefaultDescription(boolean repeatable)
          Returns the suggested extension description with configurable repeatability.
 XmlParser.ElementHandler getHandler(ExtensionProfile extProfile, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs)
          The default implementation uses the AbstractExtension.AttributesHandler to handle parsing the extension.
 java.lang.Double getLatitude()
           
 java.lang.Double getLongitude()
           
 void setGeoLocation(java.lang.Double lat, java.lang.Double lon)
          Sets the geo location based on the passed in lat and lon values.
 
Methods inherited from class com.google.gdata.data.ExtensionPoint
addExtension, addExtension, addRepeatingExtension, addRepeatingExtension, checkRequiredExtensions, createExtensionInstance, generate, generateCumulativeXmlBlob, generateExtensions, generateStartElement, getExtension, getExtensionDescription, getExtensionHandler, getExtensions, 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, disableStrictValidation, enableStrictValidation, eq, generateAttributes, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, putAttributes, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

W3CPoint

public W3CPoint()
Constructs an empty geo:Point element.


W3CPoint

public W3CPoint(java.lang.Double lat,
                java.lang.Double lon)
Constructs a geo:Point element with child geo:lat and geo:long elements based on the parameters passed in.

Parameters:
lat - The latitude coordinate of this point.
lon - The longitude coordinate of this point.

W3CPoint

public W3CPoint(Point copyFrom)
Constructs a geo:Point element copying the lat and lon values from the given point. If the given point is null an empty geo:Point element will be created.

Method Detail

getDefaultDescription

public static ExtensionDescription getDefaultDescription(boolean repeatable)
Returns the suggested extension description with configurable repeatability.


getDefaultDescription

public static ExtensionDescription getDefaultDescription()
Returns the suggested extension description and is repeatable.


declareExtensions

public void declareExtensions(ExtensionProfile extProfile)
Description copied from class: ExtensionPoint
Declares the set of expected Extension types for an ExtensionPoint within the target extension profile. The base implementation does not declare any extensions, but can be overridden by specific types of ExtensionPoints that always contain a well-defined set of extensions.

Overrides:
declareExtensions in class ExtensionPoint
Parameters:
extProfile - the ExtensionProfile to initialize.

getLatitude

public java.lang.Double getLatitude()
Specified by:
getLatitude in interface Point
Returns:
the value of the geo:lat element within this Point.

getLongitude

public java.lang.Double getLongitude()
Specified by:
getLongitude in interface Point
Returns:
the value of the geo:long element within this Point.

setGeoLocation

public void setGeoLocation(java.lang.Double lat,
                           java.lang.Double lon)
Sets the geo location based on the passed in lat and lon values. Both must be null or non null, and the lat must be between -90 and 90, and the lon between -180 and 180.

Specified by:
setGeoLocation in interface Point
Parameters:
lat - The latitude in degrees, from -90 to 90.
lon - The longitude in degrees, from -180 to 180.

generate

public void generate(com.google.gdata.util.common.xml.XmlWriter w,
                     ExtensionProfile extProfile)
              throws java.io.IOException
Generates the XML corresponding to this GeoPoint.

Specified by:
generate in interface Extension
Overrides:
generate in class AbstractExtension
Parameters:
w - XML writer
extProfile - extension profile
Throws:
java.io.IOException

getHandler

public XmlParser.ElementHandler getHandler(ExtensionProfile extProfile,
                                           java.lang.String namespace,
                                           java.lang.String localName,
                                           org.xml.sax.Attributes attrs)
Description copied from class: AbstractExtension
The default implementation uses the AbstractExtension.AttributesHandler to handle parsing the extension.

Specified by:
getHandler in interface Extension
Overrides:
getHandler in class ExtensionPoint
Parameters:
extProfile - extension profile
namespace - extension namespace
localName - tag name, without the namespace prefix
attrs - tag attributes
Returns:
a handler for processing a W3C geo:Point element. All points must have a latitude and longitude element.