|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.data.AbstractExtension
com.google.gdata.data.ValueConstruct
public abstract class ValueConstruct
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
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 |
---|
public final boolean isRequired()
public java.lang.String getValue()
public void setValue(java.lang.String v)
v
- new value for the value construct or null
to reset.
java.lang.IllegalArgumentException
- if the value is invalid for the construct.
java.lang.IllegalStateException
- if the value construct is read onlypublic boolean hasValue()
public void putAttributes(AttributeGenerator generator)
AbstractExtension
AbstractExtension.generate(XmlWriter,ExtensionProfile)
. Default implementation
does nothing, though generally this is discouraged unless there really are
no attributes.
generator
- attribute generatorpublic void generate(XmlWriter w, ExtensionProfile p) throws java.io.IOException
Extension
generate
in interface Extension
generate
in class AbstractExtension
w
- XML writerp
- extension profile
java.io.IOException
public XmlParser.ElementHandler getHandler(ExtensionProfile p, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs) throws ParseException
AbstractExtension
AttributesHandler
to handle
parsing the extension.
getHandler
in interface Extension
getHandler
in class AbstractExtension
p
- extension profilenamespace
- extension namespacelocalName
- tag name, without the namespace prefixattrs
- tag attributes
ParseException
- when an unexpected tag or badly-formatted
XML is detectedpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |