org.apache.abdera.model
Class ElementWrapper

java.lang.Object
  extended by org.apache.abdera.model.ElementWrapper
All Implemented Interfaces:
Cloneable, Iterable<Element>, Base, Element
Direct Known Subclasses:
DateTimeWrapper, ExtensibleElementWrapper, Foo

public abstract class ElementWrapper
extends Object
implements Element

Base implementation used for static extensions.


Constructor Summary
protected ElementWrapper(Element internal)
           
protected ElementWrapper(Factory factory, QName qname)
           
 
Method Summary
<T extends Base>
T
addComment(String value)
          Add an XML comment to this Base
 Object clone()
          Clone this Base
<T extends Base>
T
complete()
          Ensure that the underlying streams are fully parsed.
<T extends Element>
T
declareNS(String uri, String prefix)
          Declare a namespace
 void discard()
          Removes this element from its current document
 boolean equals(Object other)
           
 List<QName> getAttributes()
          Returns a listing of all attributes on this element
 String getAttributeValue(QName qname)
          Returns the value of the named attribute
 String getAttributeValue(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.
 WriterOptions getDefaultWriterOptions()
          Get the default WriterOptions for this object
<T extends Element>
Document<T>
getDocument()
          Returns the document to which this element belongs
<T extends Element>
List<T>
getElements()
          Return a listing of this elements child elements
 List<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(QName qname)
          Get the first child element with the given QName
 Element getInternal()
           
 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
 Locale getLocale()
          Returns a Locale object created from the xml:lang attribute
 boolean getMustPreserveWhitespace()
          Return true if insignificant whitespace must be preserved
 Map<String,String> getNamespaces()
          Return a map listing the xml namespaces declared for this element
<T extends Element>
T
getNextSibling()
          Get the element following this one
<T extends Element>
T
getNextSibling(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(QName qname)
          Get the first previous sibling with the specified QName
 QName getQName()
          Return the XML QName of this element
 IRI getResolvedBaseUri()
          Returns the current in-scope, fully qualified Base URI for this element.
 String getText()
          Returns the Text value of this element
 int hashCode()
           
 Iterator<Element> iterator()
           
<T extends Element>
T
removeAttribute(QName qname)
          Remove the named Attribute
<T extends Element>
T
removeAttribute(String name)
          Remove the named attribute
<T extends Element>
T
setAttributeValue(QName qname, String value)
          Sets the value of the named attribute
<T extends Element>
T
setAttributeValue(String name, String value)
          Sets the value of the named attribute
<T extends Element>
T
setBaseUri(IRI base)
          Sets the value of this element's xml:base attribute.
<T extends Element>
T
setBaseUri(String base)
          Sets the value of this element's xml:base attribute.
<T extends Element>
T
setLanguage(String language)
          Sets the value of this elements xml:lang attribute.
<T extends Element>
T
setMustPreserveWhitespace(boolean preserve)
          Set to true to preserve insignificant whitespace
<T extends Element>
T
setParentElement(Element parent)
          Set this Element's parent element
<T extends Element>
T
setText(javax.activation.DataHandler handler)
          Set the Text value of this element using the data handler
 void setText(String text)
          Set the Text value of this element
 String toString()
           
 void writeTo(OutputStream out)
          Serializes the model component out to the specified stream
 void writeTo(OutputStream out, WriterOptions options)
          Serializes the model component out to the specified stream
 void writeTo(String writer, OutputStream out)
          Serializes the model component out to the specified stream using the given Abdera writer
 void writeTo(String writer, OutputStream out, WriterOptions options)
          Serializes the model component out to the specified stream using the given abdera writer
 void writeTo(String writer, Writer out)
          Serializes the model component out to the specified java.io.Writer using the given Abdera writer
 void writeTo(String writer, Writer out, WriterOptions options)
          Serializes the model component out to the specified java.io.Writer using the given abdera writer
 void writeTo(Writer writer)
          Serializes the model component out to the specified writer
 void writeTo(Writer writer, OutputStream out)
          Serializes the model component out to the specified stream using the given Abdera writer
 void writeTo(Writer writer, OutputStream out, WriterOptions options)
          Serializes the model component out to the specified stream using the given abdera writer
 void writeTo(Writer writer, Writer out)
          Serializes the model component out to the specified java.io.Writer using the given Abdera writer
 void writeTo(Writer out, WriterOptions options)
          Serializes the model component out to the specified java.io.Writer
 void writeTo(Writer writer, Writer out, WriterOptions options)
          Serializes the model component out to the specified java.io.Writer using the given abdera 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,
                         QName qname)
Method Detail

addComment

public <T extends Base> T addComment(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 Object clone()
Description copied from interface: Base
Clone this Base

Specified by:
clone in interface Base
Overrides:
clone in class Object

declareNS

public <T extends Element> T declareNS(String uri,
                                       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 List<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 String getAttributeValue(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 String getAttributeValue(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()
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

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 List<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 object

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(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 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()
Description copied from interface: Element
Returns the value of the xml:lang attribute as a Lang object

Specified by:
getLanguageTag in interface Element

getLocale

public 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(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(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 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()
Description copied from interface: Element
Returns the current in-scope, fully qualified Base URI for this element.

Specified by:
getResolvedBaseUri in interface Element

getText

public 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 <T extends Element> T removeAttribute(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

removeAttribute

public <T extends Element> T removeAttribute(String name)
Description copied from interface: Element
Remove the named attribute

Specified by:
removeAttribute in interface Element
Parameters:
name - The name of the attribute to remove

setAttributeValue

public <T extends Element> T setAttributeValue(QName qname,
                                               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 <T extends Element> T setAttributeValue(String name,
                                               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 <T extends Element> T 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 <T extends Element> T setBaseUri(String 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 Base IRI

setLanguage

public <T extends Element> T setLanguage(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 <T extends Element> T 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(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

setText

public <T extends Element> T setText(javax.activation.DataHandler handler)
Description copied from interface: Element
Set the Text value of this element using the data handler

Specified by:
setText in interface Element

writeTo

public void writeTo(OutputStream out)
             throws 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:
IOException

writeTo

public void writeTo(Writer writer)
             throws 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:
IOException

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getInternal

public Element getInternal()

getElements

public <T extends Element> List<T> getElements()
Description copied from interface: Element
Return a listing of this elements child elements

Specified by:
getElements in interface Element

getNamespaces

public Map<String,String> getNamespaces()
Description copied from interface: Element
Return a map listing the xml namespaces declared for this element

Specified by:
getNamespaces in interface Element

getMustPreserveWhitespace

public boolean getMustPreserveWhitespace()
Description copied from interface: Element
Return true if insignificant whitespace must be preserved

Specified by:
getMustPreserveWhitespace in interface Element

setMustPreserveWhitespace

public <T extends Element> T setMustPreserveWhitespace(boolean preserve)
Description copied from interface: Element
Set to true to preserve insignificant whitespace

Specified by:
setMustPreserveWhitespace in interface Element

writeTo

public void writeTo(OutputStream out,
                    WriterOptions options)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified stream

Specified by:
writeTo in interface Base
Parameters:
out - The target output stream
options - The WriterOptions to use
Throws:
IOException

writeTo

public void writeTo(Writer writer,
                    OutputStream out,
                    WriterOptions options)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified stream using the given abdera writer

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output stream
options - The WriterOptions to use
Throws:
IOException

writeTo

public void writeTo(Writer writer,
                    OutputStream out)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified stream using the given Abdera writer

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output stream
Throws:
IOException

writeTo

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

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output writer
options - The WriterOptions to use
Throws:
IOException

writeTo

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

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output writer
Throws:
IOException

writeTo

public void writeTo(String writer,
                    OutputStream out,
                    WriterOptions options)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified stream using the given abdera writer

Specified by:
writeTo in interface Base
Parameters:
writer - The name of the Abdera writer to use
out - The target output stream
options - The WriterOptions to use
Throws:
IOException

writeTo

public void writeTo(String writer,
                    OutputStream out)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified stream using the given Abdera writer

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output stream
Throws:
IOException

writeTo

public void writeTo(String writer,
                    Writer out,
                    WriterOptions options)
             throws IOException
Description copied from interface: Base
Serializes the model component out to the specified java.io.Writer using the given abdera writer

Specified by:
writeTo in interface Base
Parameters:
writer - The name of the Abdera writer to use
out - The target output writer
options - The WriterOptions to use
Throws:
IOException

writeTo

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

Specified by:
writeTo in interface Base
Parameters:
writer - The Abdera writer to use
out - The target output writer
Throws:
IOException

writeTo

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

Specified by:
writeTo in interface Base
Parameters:
out - The target output writer
options - The WriterOptions to use
Throws:
IOException

getDefaultWriterOptions

public WriterOptions getDefaultWriterOptions()
Description copied from interface: Base
Get the default WriterOptions for this object

Specified by:
getDefaultWriterOptions in interface Base

complete

public <T extends Base> T complete()
Description copied from interface: Base
Ensure that the underlying streams are fully parsed. Calling complete on an Element does not necessarily mean that the underlying stream is fully consumed, only that that particular element has been completely parsed.

Specified by:
complete in interface Base

iterator

public Iterator<Element> iterator()
Specified by:
iterator in interface Iterable<Element>


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.