Google Data APIs Client Library (1.41.1)



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, Artist, BaseEventEntry.EventStatus, BaseEventEntry.Transparency, BaseEventEntry.Visibility, BillingInformation, Birthday, BlockedOnUpdate, BoolValueConstruct, CcUpdate, City, ColorProperty, Composer, CrawlIssueDetail, CrawlIssueLinkedFromUrl, CrawlIssueUrl, Creator, Date, DateTimeValueConstruct, Definition, 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, 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, Publisher, QuickAddProperty, RecordValue, Region, RegionCodeValueConstruct, 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gdata.data.AbstractExtension
AbstractExtension.AttributesHandler
 
Field Summary
protected  java.lang.String attrName
          The XML attribute name for the value construct.
 
Fields inherited from class com.google.gdata.data.AbstractExtension
localName, namespace
 
Constructor Summary
protected ValueConstruct(java.lang.String attrName)
          Constructs a value construct bound to a specific XML representation.
protected ValueConstruct(com.google.gdata.util.common.xml.XmlNamespace namespace, java.lang.String localName, java.lang.String attrName)
          Constructs an ValueConstruct bound to a specific XML representation A concrete subclass should always use constants value for all three parameters.
protected ValueConstruct(com.google.gdata.util.common.xml.XmlNamespace namespace, java.lang.String localName, java.lang.String attrName, java.lang.String value)
          Constructs a new ValueConstruct instance bound to a specific XML representation.
 
Method Summary
protected  void consumeAttributes(AttributeHelper helper)
          Consumes attributes from the attribute helper.
 boolean equals(java.lang.Object o)
           
 void generate(com.google.gdata.util.common.xml.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 AbstractExtension.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.
protected  void setRequired(boolean isRequired)
           
 void setValue(java.lang.String v)
          Sets the value.
 
Methods inherited from class com.google.gdata.data.AbstractExtension
disableStrictValidation, enableStrictValidation, eq, generate, generateAttributes, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attrName

protected final java.lang.String attrName
The XML attribute name for the value construct. When null, indicates that the value is contained within the XML element text content.

Constructor Detail

ValueConstruct

protected ValueConstruct(java.lang.String attrName)
Constructs a value construct bound to a specific XML representation. The concrete subclass must have an ExtensionDescription.Default attribute defined, and should always use constant values for the attrName parameter.

Parameters:
attrName - the name of attribute that contains the value, or null if the value is contained within the element content.

ValueConstruct

protected ValueConstruct(com.google.gdata.util.common.xml.XmlNamespace namespace,
                         java.lang.String localName,
                         java.lang.String attrName)
Constructs an ValueConstruct bound to a specific XML representation A concrete subclass should always use constants value for all three parameters.

Parameters:
namespace - the namespace of the value element.
localName - the local name of the value element.
attrName - the name of attribute that contains the value, or null if the value is contained within the element content.

ValueConstruct

protected ValueConstruct(com.google.gdata.util.common.xml.XmlNamespace namespace,
                         java.lang.String localName,
                         java.lang.String attrName,
                         java.lang.String value)
Constructs a new ValueConstruct instance bound to a specific XML representation. A concrete subclass should always use constant values for the namespace, localName, and attrName parameters. If an initial value is provided and it is not null, an immutable instance will be created that is initialized to this value and may not be modified by setValue(String).

Parameters:
namespace - the namespace of the value element.
localName - the local name of the value element.
attrName - the name of attribute that contains the value, or null if the value is contained within the element content.
value - the value that should be used to initialize the value construct instance. After construction, the value will be immutable.
Method Detail

isRequired

public final boolean isRequired()

setRequired

protected final void setRequired(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.

Overrides:
putAttributes in class AbstractExtension
Parameters:
generator - attribute generator

consumeAttributes

protected void consumeAttributes(AttributeHelper helper)
                          throws ParseException
Description copied from class: AbstractExtension
Consumes attributes from the attribute helper. May also use AttributeHelper.consumeContent(boolean) to consume the element's text content. Called from AbstractExtension.getHandler(com.google.gdata.data.ExtensionProfile, java.lang.String, java.lang.String, org.xml.sax.Attributes). Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

Overrides:
consumeAttributes in class AbstractExtension
Parameters:
helper - attribute helper
Throws:
ParseException - any parsing exception

generate

public void generate(com.google.gdata.util.common.xml.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 AbstractExtension.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