public class DefaultFragmentTransformer extends Object implements FragmentTransformer, MigrationAware
This can be thought of as the top-level Transformer since it includes the behaviour of writing out any events that have no specific handling configured.
There are two ways of causing transformation:
ElementTransformer
which will transform individual elements read.FragmentTransformer
which will take well formed fragments of XML and transform them.
Note that in both FragmentTransformer
and ElementTransformer
the order of the configured transformers is the
order they are applied. All ElementTransformer
are applied before FragmentTransformer
.
If you prefer to scope the application of ElementTransformer
to a particular fragment of XML then instead of
configuring them here in the DefaultFragmentTransformer you should instead use an ElementTransformingFragmentTransformer
which will scope the Element transformations to a particular fragment of XML.
MigrationAware.MigrationPerformedPredicate
Constructor and Description |
---|
DefaultFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers,
XmlOutputFactory xmlFragmentOutputFactory,
XmlEventReaderFactory xmlEventReaderFactory,
FragmentTransformationErrorHandler fragmentTransformationErrorHandler,
com.atlassian.event.api.EventPublisher eventPublisher) |
DefaultFragmentTransformer(List<ElementTransformer> elementTransformers,
List<? extends FragmentTransformer> fragmentTransformers,
XmlOutputFactory xmlFragmentOutputFactory,
XmlEventReaderFactory xmlEventReaderFactory,
FragmentTransformationErrorHandler fragmentTransformationErrorHandler,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
static DefaultFragmentTransformer |
createMigrationAwareFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers,
XmlOutputFactory xmlFragmentOutputFactory,
XmlEventReaderFactory xmlEventReaderFactory,
FragmentTransformationErrorHandler fragmentTransformationErrorHandler,
com.atlassian.event.api.EventPublisher eventPublisher) |
boolean |
handles(StartElement startElementEvent,
ConversionContext conversionContext)
This fragment converter handles every XHTML element that is not handled by any other converter.
|
Streamable |
transform(XMLEventReader reader,
FragmentTransformer defaultFragmentTransformer,
ConversionContext conversionContext)
Transform the XML read from the supplied reader, making use of any configured FragmentTransformers as appropriate.
|
boolean |
wasMigrationPerformed(ConversionContext conversionContext)
Given a
ConversionContext that was previously used to perform a migration, determine if that context
contains information that indicates whether a "migration" was performed. |
public DefaultFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers, XmlOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformationErrorHandler fragmentTransformationErrorHandler, @Nullable com.atlassian.event.api.EventPublisher eventPublisher)
public DefaultFragmentTransformer(List<ElementTransformer> elementTransformers, List<? extends FragmentTransformer> fragmentTransformers, XmlOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformationErrorHandler fragmentTransformationErrorHandler, @Nullable com.atlassian.event.api.EventPublisher eventPublisher)
public static DefaultFragmentTransformer createMigrationAwareFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers, XmlOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformationErrorHandler fragmentTransformationErrorHandler, com.atlassian.event.api.EventPublisher eventPublisher)
MigrationAware
FragmentTransformer
which guarantees that every delegate
FragmentTransformer
is also MigrationAware
.public Streamable transform(XMLEventReader reader, FragmentTransformer defaultFragmentTransformer, ConversionContext conversionContext) throws XhtmlException
transform
in interface FragmentTransformer
XhtmlException
public boolean handles(StartElement startElementEvent, ConversionContext conversionContext)
handles
in interface FragmentTransformer
public boolean wasMigrationPerformed(ConversionContext conversionContext)
MigrationAware
ConversionContext
that was previously used to perform a migration, determine if that context
contains information that indicates whether a "migration" was performed. What constitutes a migration is
implementation-dependent.wasMigrationPerformed
in interface MigrationAware
conversionContext
- the context used for the migrationMigrationAware
FragmentTransformer
s think a migration was performed,
false otherwise.Copyright © 2003–2016 Atlassian. All rights reserved.