org.apache.abdera.model
Class ElementWrapper

java.lang.Object
  extended by org.apache.abdera.model.ElementWrapper
All Implemented Interfaces:
java.lang.Cloneable, Base, Element
Direct Known Subclasses:
ExtensibleElementWrapper, InReplyTo, IntegerElement, MediaAdult, MediaCategory, MediaCopyright, MediaCredit, MediaDescription, MediaHash, MediaKeywords, MediaPlayer, MediaRating, MediaRestriction, MediaText, MediaThumbnail, MediaTitle, Query, Total

public abstract class ElementWrapper
extends java.lang.Object
implements Element


Constructor Summary
protected ElementWrapper(Element internal)
           
protected ElementWrapper(Factory factory, javax.xml.namespace.QName qname)
           
 
Method Summary
 void addComment(java.lang.String value)
          Add an XML comment to this Base
 java.lang.Object clone()
          Clone this Base
 void declareNS(java.lang.String uri, java.lang.String prefix)
          Declare a namespace
 void discard()
          Removes this element from its current document
 boolean equals(java.lang.Object other)
           
 java.util.List<javax.xml.namespace.QName> getAttributes()
          Returns a listing of all attributes on this element
 java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
          Returns the value of the named attribute
 java.lang.String getAttributeValue(java.lang.String name)
          Returns the value of the named attribute
 IRI getBaseUri()
          Returns the value of this element's xml:base attribute or null if xml:base is undefined.
<T extends Element>
Document<T>
getDocument()
          Returns the document to which this element belongs
 java.util.List<javax.xml.namespace.QName> getExtensionAttributes()
          Returns a listing of extension attributes on this element (extension attributes are attributes whose namespace URI is different than the elements)
 Factory getFactory()
          Get the Factory used to create this Base
<T extends Element>
T
getFirstChild()
          Get the first child element
<T extends Element>
T
getFirstChild(javax.xml.namespace.QName qname)
          Get the first child element with the given QName
 Element getInternal()
           
 java.lang.String getLanguage()
          Returns the value of this elements xml:lang attribute or null if xml:lang is undefined.
 Lang getLanguageTag()
          Returns the value of the xml:lang attribute as a Lang object
 java.util.Locale getLocale()
          Returns a Locale object created from the xml:lang attribute
<T extends Element>
T
getNextSibling()
          Get the element following this one
<T extends Element>
T
getNextSibling(javax.xml.namespace.QName qname)
          Get the first following sibling with the specified QName
<T extends Base>
T
getParentElement()
          Return this Element's parent element or document
<T extends Element>
T
getPreviousSibling()
          Get the element preceding this one
<T extends Element>
T
getPreviousSibling(javax.xml.namespace.QName qname)
          Get the first previous sibling with the specified QName
 javax.xml.namespace.QName getQName()
          Return the XML QName of this element
 IRI getResolvedBaseUri()
          Returns the current in-scope, fully qualified Base URI for this element.
 java.lang.String getText()
          Returns the Text value of this element
 int hashCode()
           
 void removeAttribute(javax.xml.namespace.QName qname)
          Remove the named Attribute
 void setAttributeValue(javax.xml.namespace.QName qname, java.lang.String value)
          Sets the value of the named attribute
 void setAttributeValue(java.lang.String name, java.lang.String value)
          Sets the value of the named attribute
 void setBaseUri(IRI base)
          Sets the value of this element's xml:base attribute.
 void setBaseUri(java.lang.String base)
          Sets the value of this element's xml:base attribute.
 void setLanguage(java.lang.String language)
          Sets the value of this elements xml:lang attribute.
 void setParentElement(Element parent)
          Set this Element's parent element
 void setText(java.lang.String text)
          Set the Text value of this element
 java.lang.String toString()
           
 void writeTo(java.io.OutputStream out)
          Serializes the model component out to the specified stream
 void writeTo(java.io.Writer writer)
          Serializes the model component out to the specified writer
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementWrapper

protected ElementWrapper(Element internal)

ElementWrapper

protected ElementWrapper(Factory factory,
                         javax.xml.namespace.QName qname)
Method Detail

addComment

public void addComment(java.lang.String value)
Description copied from interface: Base
Add an XML comment to this Base

Specified by:
addComment in interface Base
Parameters:
value - The text value of the comment

clone

public java.lang.Object clone()
Description copied from interface: Base
Clone this Base

Specified by:
clone in interface Base
Overrides:
clone in class java.lang.Object

declareNS

public void declareNS(java.lang.String uri,
                      java.lang.String prefix)
Description copied from interface: Element
Declare a namespace

Specified by:
declareNS in interface Element

discard

public void discard()
Description copied from interface: Element
Removes this element from its current document

Specified by:
discard in interface Element

getAttributes

public java.util.List<javax.xml.namespace.QName> getAttributes()
Description copied from interface: Element
Returns a listing of all attributes on this element

Specified by:
getAttributes in interface Element
Returns:
The listing of attributes for this element

getAttributeValue

public java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
Description copied from interface: Element
Returns the value of the named attribute

Specified by:
getAttributeValue in interface Element
Parameters:
qname - The XML QName of the attribute
Returns:
The value of the attribute

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Description copied from interface: Element
Returns the value of the named attribute

Specified by:
getAttributeValue in interface Element
Parameters:
name - The name of the attribute
Returns:
The value of the attribute

getBaseUri

public IRI getBaseUri()
               throws IRISyntaxException
Description copied from interface: Element
Returns the value of this element's xml:base attribute or null if xml:base is undefined.

Specified by:
getBaseUri in interface Element
Returns:
The Base URI
Throws:
IRISyntaxException - if the Base URI is malformed

getDocument

public <T extends Element> Document<T> getDocument()
Description copied from interface: Element
Returns the document to which this element belongs

Specified by:
getDocument in interface Element
Returns:
The Document to which this element belongs

getExtensionAttributes

public java.util.List<javax.xml.namespace.QName> getExtensionAttributes()
Description copied from interface: Element
Returns a listing of extension attributes on this element (extension attributes are attributes whose namespace URI is different than the elements)

Specified by:
getExtensionAttributes in interface Element
Returns:
The listing non-Atom attributes

getFactory

public Factory getFactory()
Description copied from interface: Base
Get the Factory used to create this Base

Specified by:
getFactory in interface Base
Returns:
The Factory used to create this Base

getFirstChild

public <T extends Element> T getFirstChild()
Description copied from interface: Element
Get the first child element

Specified by:
getFirstChild in interface Element
Returns:
The first child

getFirstChild

public <T extends Element> T getFirstChild(javax.xml.namespace.QName qname)
Description copied from interface: Element
Get the first child element with the given QName

Specified by:
getFirstChild in interface Element
Parameters:
qname - The XML QName of the sibling to find
Returns:
The matching element

getLanguage

public java.lang.String getLanguage()
Description copied from interface: Element
Returns the value of this elements xml:lang attribute or null if xml:lang is undefined.

Specified by:
getLanguage in interface Element
Returns:
The xml:lang value

getLanguageTag

public Lang getLanguageTag()
                    throws InvalidLangTagSyntax
Description copied from interface: Element
Returns the value of the xml:lang attribute as a Lang object

Specified by:
getLanguageTag in interface Element
Throws:
InvalidLangTagSyntax

getLocale

public java.util.Locale getLocale()
Description copied from interface: Element
Returns a Locale object created from the xml:lang attribute

Specified by:
getLocale in interface Element
Returns:
A Locale appropriate for the Language (xml:lang)

getNextSibling

public <T extends Element> T getNextSibling()
Description copied from interface: Element
Get the element following this one

Specified by:
getNextSibling in interface Element
Returns:
The following sibling

getNextSibling

public <T extends Element> T getNextSibling(javax.xml.namespace.QName qname)
Description copied from interface: Element
Get the first following sibling with the specified QName

Specified by:
getNextSibling in interface Element
Parameters:
qname - The XML QName of the sibling to find
Returns:
The matching element

getParentElement

public <T extends Base> T getParentElement()
Description copied from interface: Element
Return this Element's parent element or document

Specified by:
getParentElement in interface Element
Returns:
The parent

getPreviousSibling

public <T extends Element> T getPreviousSibling()
Description copied from interface: Element
Get the element preceding this one

Specified by:
getPreviousSibling in interface Element
Returns:
The preceding sibling

getPreviousSibling

public <T extends Element> T getPreviousSibling(javax.xml.namespace.QName qname)
Description copied from interface: Element
Get the first previous sibling with the specified QName

Specified by:
getPreviousSibling in interface Element
Parameters:
qname - The XML QName of the sibling to find
Returns:
The matching element

getQName

public javax.xml.namespace.QName getQName()
Description copied from interface: Element
Return the XML QName of this element

Specified by:
getQName in interface Element
Returns:
The QName of the element

getResolvedBaseUri

public IRI getResolvedBaseUri()
                       throws IRISyntaxException
Description copied from interface: Element
Returns the current in-scope, fully qualified Base URI for this element.

Specified by:
getResolvedBaseUri in interface Element
Throws:
IRISyntaxException - if the Base URI is malformed

getText

public java.lang.String getText()
Description copied from interface: Element
Returns the Text value of this element

Specified by:
getText in interface Element
Returns:
The text value

removeAttribute

public void removeAttribute(javax.xml.namespace.QName qname)
Description copied from interface: Element
Remove the named Attribute

Specified by:
removeAttribute in interface Element
Parameters:
qname - The XML QName of the attribute to remove

setAttributeValue

public void setAttributeValue(javax.xml.namespace.QName qname,
                              java.lang.String value)
Description copied from interface: Element
Sets the value of the named attribute

Specified by:
setAttributeValue in interface Element
Parameters:
qname - The XML QName of the attribute
value - The value of the attribute

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.String value)
Description copied from interface: Element
Sets the value of the named attribute

Specified by:
setAttributeValue in interface Element
Parameters:
name - The name of the attribute
value - The value of the attribute

setBaseUri

public void setBaseUri(IRI base)
Description copied from interface: Element
Sets the value of this element's xml:base attribute.

Specified by:
setBaseUri in interface Element
Parameters:
base - The IRI base value

setBaseUri

public void setBaseUri(java.lang.String base)
                throws IRISyntaxException
Description copied from interface: Element
Sets the value of this element's xml:base attribute.

Specified by:
setBaseUri in interface Element
Parameters:
base - The Base IRI
Throws:
IRISyntaxException - if the base URI is malformed

setLanguage

public void setLanguage(java.lang.String language)
Description copied from interface: Element
Sets the value of this elements xml:lang attribute.

Specified by:
setLanguage in interface Element
Parameters:
language - the value of the xml:lang element

setParentElement

public void setParentElement(Element parent)
Description copied from interface: Element
Set this Element's parent element

Specified by:
setParentElement in interface Element
Parameters:
parent - The parent element

setText

public void setText(java.lang.String text)
Description copied from interface: Element
Set the Text value of this element

Specified by:
setText in interface Element
Parameters:
text - The text value

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Description copied from interface: Base
Serializes the model component out to the specified stream

Specified by:
writeTo in interface Base
Parameters:
out - The java.io.OutputStream to use when serializing the Base. The charset encoding specified for the document will be used
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.Writer writer)
             throws java.io.IOException
Description copied from interface: Base
Serializes the model component out to the specified writer

Specified by:
writeTo in interface Base
Parameters:
writer - The java.io.Writer to use when serializing the Base
Throws:
java.io.IOException

equals

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

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

getInternal

public Element getInternal()