pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.xml.bind
Class ElementXmlAdapter

java.lang.Object
  extended by javax.xml.bind.annotation.adapters.XmlAdapter<ElementWrapper,org.jdom.Element>
      extended by org.torweg.pulse.util.xml.bind.ElementXmlAdapter

public final class ElementXmlAdapter
extends javax.xml.bind.annotation.adapters.XmlAdapter<ElementWrapper,org.jdom.Element>

is a JAXB XMLAdapter which allows to marshal and unmarshal org.jdom.Elements ( @XmlJavaTypeAdapter(ElementXmlAdapter.class)).

Fields or properties of the type org.jdom.Element can be used to bind XML fragments to a Java type when annotated with @XmlJavaTypeAdapter(ElementXmlAdapter.class):

 public class Something {
 
        @XmlJavaTypeAdapter(ElementXmlAdapter.class)
        private Element jdom = new Element("p").addContent(new Text("This is "))
                        .addContent(new Element("em").setText("mark-up")).addContent(
                                        new Text(" in the object graph!"));
 
 }
 
leads to
 <something>
    <jdom>
       <p>This is <em>mark-up</em> in the object graph!</p>
    </jdom>
 </something>
 

Version:
$Revision: 1426 $
Author:
Thomas Weber

Constructor Summary
ElementXmlAdapter()
           
 
Method Summary
 ElementWrapper marshal(org.jdom.Element element)
          returns the wrapped Element ready to be unmarshalled by JAXB.
 org.jdom.Element unmarshal(ElementWrapper wrapper)
          returns the completely unmarshalled Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementXmlAdapter

public ElementXmlAdapter()
Method Detail

unmarshal

public org.jdom.Element unmarshal(ElementWrapper wrapper)
returns the completely unmarshalled Element.

Specified by:
unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<ElementWrapper,org.jdom.Element>
Parameters:
wrapper - the wrapped element
Returns:
the Element

marshal

public ElementWrapper marshal(org.jdom.Element element)
returns the wrapped Element ready to be unmarshalled by JAXB.

Specified by:
marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<ElementWrapper,org.jdom.Element>
Parameters:
element - the element to be wrapped
Returns:
the wrapped Element