|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.data.AbstractExtension
public abstract class AbstractExtension
Common extension implementation for sharing code among implementers of
Extension
. The information contained in this class is:
Nested Class Summary | |
---|---|
protected class |
AbstractExtension.AttributesHandler
Base class for custom element handlers that uses AttributeHelper
to consume the attributes and the element's text content. |
Field Summary | |
---|---|
protected java.lang.String |
localName
XML local name for this extension or null if not defined |
protected XmlNamespace |
namespace
XML namespace for this extension or null if not defined |
Constructor Summary | |
---|---|
protected |
AbstractExtension()
Constructs an extension bound to a specific XML representation. |
protected |
AbstractExtension(XmlNamespace namespace,
java.lang.String localName)
Constructs an extension bound to a specific XML representation. |
Method Summary | |
---|---|
protected void |
consumeAttributes(AttributeHelper helper)
Consumes attributes from the attribute helper. |
static void |
disableStrictValidation()
|
static void |
enableStrictValidation()
|
protected static boolean |
eq(java.lang.Object o1,
java.lang.Object o2)
|
void |
generate(XmlWriter w,
ExtensionProfile p)
Generates an XML representation for the extension. |
protected void |
generate(XmlWriter w,
ExtensionProfile p,
XmlNamespace namespace,
java.lang.String localName,
java.util.List<XmlWriter.Attribute> attrs,
AttributeGenerator generator)
Generates the XML into the XML writer. |
protected void |
generateAttributes(java.util.List<XmlWriter.Attribute> attrs,
AttributeGenerator generator)
Generates the attributes in the generator into the list of attributes. |
java.lang.String |
getExtensionLocalName()
Gets the extension's localname. |
XmlNamespace |
getExtensionNamespace()
Gets the extension's namespace. |
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. |
boolean |
isImmutable()
|
static boolean |
isStrictValidation()
|
protected void |
putAttributes(AttributeGenerator generator)
Puts attributes into the attribute generator. |
protected boolean |
sameClassAs(java.lang.Object o)
|
void |
setImmutable(boolean isImmutable)
|
protected static void |
throwExceptionForMissingAttribute(java.lang.String attrName)
Throws an IllegalStateException if the value is required
and it is missing. |
protected void |
throwExceptionIfImmutable()
Throws an IllegalStateException if this instance is immutable. |
protected void |
validate()
Checks the attributes to see if there are any problems. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final XmlNamespace namespace
null
if not defined
protected final java.lang.String localName
null
if not defined
Constructor Detail |
---|
protected AbstractExtension()
ExtensionDescription.Default
attribute defined to use this constructor.
protected AbstractExtension(XmlNamespace namespace, java.lang.String localName)
namespace
- the namespace of the value elementlocalName
- the local name of the value elementMethod Detail |
---|
public static final boolean isStrictValidation()
public static final void enableStrictValidation()
public static final void disableStrictValidation()
public final boolean isImmutable()
public final void setImmutable(boolean isImmutable)
public final XmlNamespace getExtensionNamespace()
public final java.lang.String getExtensionLocalName()
protected void validate() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if any problems are found with the
attributesprotected void putAttributes(AttributeGenerator generator)
generate(XmlWriter,ExtensionProfile)
. Default implementation
does nothing, though generally this is discouraged unless there really are
no attributes.
generator
- attribute generatorprotected void consumeAttributes(AttributeHelper helper) throws ParseException
AttributeHelper.consumeContent(boolean)
to consume the element's text
content. Called from 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.
helper
- attribute helper
ParseException
- any parsing exceptionprotected void generate(XmlWriter w, ExtensionProfile p, XmlNamespace namespace, java.lang.String localName, java.util.List<XmlWriter.Attribute> attrs, AttributeGenerator generator) throws java.io.IOException
w
- XML writerp
- extension profilenamespace
- XML namespace for this extensionlocalName
- XML local name for this extensionattrs
- list of XML attributesgenerator
- attribute generator
java.io.IOException
- any I/O exceptionpublic void generate(XmlWriter w, ExtensionProfile p) throws java.io.IOException
Extension
generate
in interface Extension
w
- XML writerp
- extension profile
java.io.IOException
protected void generateAttributes(java.util.List<XmlWriter.Attribute> attrs, AttributeGenerator generator)
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
p
- extension profilenamespace
- extension namespacelocalName
- tag name, without the namespace prefixattrs
- tag attributes
ParseException
- when an unexpected tag or badly-formatted
XML is detectedprotected final void throwExceptionIfImmutable()
IllegalStateException
if this instance is immutable.
Should only be used in a value-setter method.
protected static final void throwExceptionForMissingAttribute(java.lang.String attrName)
IllegalStateException
if the value is required
and it is missing.
attrName
- attribute name
java.lang.IllegalStateException
- to indicate that there are problems with the
attributesprotected boolean sameClassAs(java.lang.Object o)
o
- given object
protected static boolean eq(java.lang.Object o1, java.lang.Object o2)
o1
- object 1 or null
o2
- object 2 or null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |