com.atlassian.confluence.content.render.xhtml.storage.link
Class StoragePlainTextLinkBodyUnmarshaller

java.lang.Object
  extended by com.atlassian.confluence.content.render.xhtml.storage.link.StoragePlainTextLinkBodyUnmarshaller
All Implemented Interfaces:
Unmarshaller<PlainTextLinkBody>

public class StoragePlainTextLinkBodyUnmarshaller
extends java.lang.Object
implements Unmarshaller<PlainTextLinkBody>

Handle a link body that is expected to contain only HTML encoded character data. This data will be decoded and returned in the PlainTextLinkBody.

Any events encountered with the reader that are not characters or entity data are ignored.


Constructor Summary
StoragePlainTextLinkBodyUnmarshaller()
           
 
Method Summary
 boolean handles(javax.xml.stream.events.StartElement startElementEvent, ConversionContext conversionContext)
          Determines whether or not this unmarshaller should be applied to a fragment with the specified start element.
 PlainTextLinkBody unmarshal(javax.xml.stream.XMLEventReader reader, FragmentTransformer mainFragmentTransformer, ConversionContext conversionContext)
          Implementation Note: In actual use this Unmarshaller will be operating on a 'storage reader'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoragePlainTextLinkBodyUnmarshaller

public StoragePlainTextLinkBodyUnmarshaller()
Method Detail

unmarshal

public PlainTextLinkBody unmarshal(javax.xml.stream.XMLEventReader reader,
                                   FragmentTransformer mainFragmentTransformer,
                                   ConversionContext conversionContext)
                            throws XhtmlException
Implementation Note: In actual use this Unmarshaller will be operating on a 'storage reader'. The storage reader (com.atlassian.confluence.content.render.xhtml.DefaultXmlEventReaderFactory.createXmlEventReaderWithNamespaces(Reader, List, boolean)) actually performs entity replacement automatically.

However to both allow for unit testing and for safety should the reader configuration change then this unmarshaller will also perform explicit HTML decoding on the link body read.

Specified by:
unmarshal in interface Unmarshaller<PlainTextLinkBody>
Parameters:
reader - a reader over the fragment to unmarshall
mainFragmentTransformer - TODO
conversionContext - the conversion context
Returns:
the decoded PlainTextLinkBody
Throws:
XhtmlException - if some other problem occurs

handles

public boolean handles(javax.xml.stream.events.StartElement startElementEvent,
                       ConversionContext conversionContext)
Description copied from interface: Unmarshaller
Determines whether or not this unmarshaller should be applied to a fragment with the specified start element.

Specified by:
handles in interface Unmarshaller<PlainTextLinkBody>
Parameters:
startElementEvent - start element
conversionContext - the conversion context
Returns:
true if this unmarshaller can be applied, false otherwise


Copyright © 2003-2013 Atlassian. All Rights Reserved.