Class StoragePlainTextLinkBodyUnmarshaller

  • All Implemented Interfaces:
    Unmarshaller<PlainTextLinkBody>

    public class StoragePlainTextLinkBodyUnmarshaller
    extends 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 Detail

      • StoragePlainTextLinkBodyUnmarshaller

        public StoragePlainTextLinkBodyUnmarshaller()
    • Method Detail

      • unmarshal

        public PlainTextLinkBody unmarshal​(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(java.io.Reader, java.util.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​(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