com.google.gdata.data
Class ValueConstruct

java.lang.Object
  extended by com.google.gdata.data.AbstractExtension
      extended by com.google.gdata.data.ValueConstruct
All Implemented Interfaces:
Extension
Direct Known Subclasses:
AccessLevelProperty, AclRole, Agent, Album, AlbumArt, AlbumArtist, ArchiveNotify, ArchiveResourceId, Artist, BaseEventEntry.EventStatus, BaseEventEntry.Transparency, BaseEventEntry.Visibility, BillingInformation, Birthday, BlockedOnUpdate, BoolValueConstruct, CcUpdate, City, ColorProperty, Composer, CrawlIssueDetail, CrawlIssueLinkedFromUrl, CrawlIssueUrl, Creator, Date, DateTimeValueConstruct, Definition, Description, Description, Description, DirectoryServer, DocumentExportRequestor, Embeddability, EndDate, EnumConstruct, ExifTag, ExportDocId, FeatureName, Format, FormattedAddress, Genre, GeoLat, GeoLong, GeoRssBox, GphotoAccess, GphotoAlbumCanonicalTitle, GphotoAlbumDescription, GphotoAlbumId, GphotoAlbumTitle, GphotoChecksum, GphotoClient, GphotoExifTime, GphotoId, GphotoLocation, GphotoName, GphotoNickname, GphotoPhotoId, GphotoRssLink, GphotoSnippet, GphotoSnippetType, GphotoStreamId, GphotoThumbnail, GphotoTruncated, GphotoType, GphotoUsername, GphotoVideoStatus, GphotoVideoUrl, GwoAbPageVariationId, GwoAnalyticsAccountId, GwoComboId, GwoComboString, GwoControlScript, GwoConversionScript, GwoCoverage, GwoExperimentId, GwoExperimentNotes, GwoNumAbPageVariations, GwoNumCombinations, GwoNumSections, GwoNumVariations, GwoSectionBeginScript, GwoSectionEndScript, GwoSectionId, GwoSourceExperimentId, GwoTrackingScript, GwoVariationId, GwoVerificationCombo, GwoVerificationComboCoverage, HiddenProperty, Hobby, HouseName, IcalUIDProperty, Identifier, Initials, IntValueConstruct, KmlSnippet, Label, Language, ListType, MaidenName, MailItemProperty, Md5Checksum, MergedIntoUpdate, MessageEntry.BodyExtension, MessageEntry.LanguageExtension, MessageEntry.SubjectExtension, Mileage, NamePrefix, NameSuffix, Neighborhood, Nickname, Occupation, OpenAccess, OrgDepartment, OrgJobDescription, OrgSymbol, OrgTitle, OverrideNameProperty, OwnerUpdate, PageName, PheedConstruct, PheedImageUrl, PheedThumbnail, PheedVideoUrl, PoBox, PointConstruct, PostCode, Project, ProjectLabel, Publisher, QuickAddProperty, RecordValue, Region, RegionCodeValueConstruct, RepositoryUrl, ResourceId, Rfc822Msg, Rights, SelectedProperty, SendEmail, SendEventNotificationsProperty, SequenceNumberProperty, ShortName, SidewikiThumbnail, SidewikiUserDescription, SitemapsEntry.SitemapStatus, SitemapsMobileEntry.MarkupLanguage, SitemapsNewsEntry.PublicationLabel, SitemapsRegularEntry.SitemapType, SiteName, SourceLanguage, StartDate, Status, Street, Subject, Subject, Subregion, Summary, SyncEventProperty, SystemGroup, TableId, TableName, TargetLanguage, Theme, TimeZoneProperty, Title, Track, Uri, Username, Viewability, Who.AttendeeStatus, Who.AttendeeType, Worksheet, Year

public abstract class ValueConstruct
extends AbstractExtension

The ValueConstruct class is an abstract Extension class that can be used to subclassed to create a GData extension element with a single value, like: or some value Using constructor parameters, a customized subclass has full control over the value construct element namespace and tag name, as well whether the value is contained within an XML attribute or the element text value.

A subclass can override the setValue(String) method to do customized validation of any value set directly by a client or as a result of XML parsing.

Two ValueConstruct instances are considered equal if they have the same concrete subclass and the value of the two instances are equal. The namespace, tagname, and attribute names are not taken into account by the equality comparison; they are assumed to be equivalent for all instances of a particular concrete subclass.


Method Summary
 boolean equals(java.lang.Object o)
           
 void generate(XmlWriter w, ExtensionProfile p)
          Generates an XML representation for the extension.
 XmlParser.ElementHandler getHandler(ExtensionProfile p, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs)
          The default implementation uses the AttributesHandler to handle parsing the extension.
 java.lang.String getValue()
          Returns the value of the value construct.
 int hashCode()
           
 boolean hasValue()
          Returns whether it has the value.
 boolean isRequired()
           
 void putAttributes(AttributeGenerator generator)
          Puts attributes into the attribute generator.
 void setValue(java.lang.String v)
          Sets the value.
 
Methods inherited from class com.google.gdata.data.AbstractExtension
disableStrictValidation, enableStrictValidation, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, setImmutable
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isRequired

public final boolean isRequired()

getValue

public java.lang.String getValue()
Returns the value of the value construct.

Returns:
the current value.

setValue

public void setValue(java.lang.String v)
Sets the value. Subclasses can override this method to do additional validation of the value.

Parameters:
v - new value for the value construct or null to reset.
Throws:
java.lang.IllegalArgumentException - if the value is invalid for the construct.
java.lang.IllegalStateException - if the value construct is read only

hasValue

public boolean hasValue()
Returns whether it has the value.

Returns:
whether it has the value

putAttributes

public void putAttributes(AttributeGenerator generator)
Description copied from class: AbstractExtension
Puts attributes into the attribute generator. Called from AbstractExtension.generate(XmlWriter,ExtensionProfile). Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

Parameters:
generator - attribute generator

generate

public void generate(XmlWriter w,
                     ExtensionProfile p)
              throws java.io.IOException
Description copied from interface: Extension
Generates an XML representation for the extension.

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

getHandler

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

Specified by:
getHandler in interface Extension
Overrides:
getHandler in class AbstractExtension
Parameters:
p - extension profile
namespace - extension namespace
localName - tag name, without the namespace prefix
attrs - tag attributes
Returns:
an element handler
Throws:
ParseException - when an unexpected tag or badly-formatted XML is detected

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object