| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| Transformation | 36 | 0 | - | 0 | 0 |
| 1 | /* | |
| 2 | * See the NOTICE file distributed with this work for additional | |
| 3 | * information regarding copyright ownership. | |
| 4 | * | |
| 5 | * This is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU Lesser General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2.1 of | |
| 8 | * the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This software is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this software; if not, write to the Free | |
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 19 | */ | |
| 20 | package org.xwiki.rendering.transformation; | |
| 21 | ||
| 22 | import org.xwiki.component.annotation.Role; | |
| 23 | import org.xwiki.rendering.block.Block; | |
| 24 | import org.xwiki.rendering.block.XDOM; | |
| 25 | import org.xwiki.rendering.syntax.Syntax; | |
| 26 | ||
| 27 | /** | |
| 28 | * Performs a transformation on a XDOM (i.e. a tree of {@link org.xwiki.rendering.block.Block}. This used for example | |
| 29 | * for transforming Macro Blocks into other Blocks corresponding to the execution of the Macros. Another example of | |
| 30 | * transformation would be looking for all words that have an entry on Wikipedia and adding links to them. | |
| 31 | * | |
| 32 | * @version $Id: fcd7e17d5e546b73484ab9e2a4a415bfe8f8fc8d $ | |
| 33 | * @since 1.5M2 | |
| 34 | */ | |
| 35 | @Role | |
| 36 | public interface Transformation extends Comparable<Transformation> | |
| 37 | { | |
| 38 | /** | |
| 39 | * The priority of execution relative to the other transformations. The lowest values have the highest priorities | |
| 40 | * and execute first. For example a Transformation with a priority of 100 will execute before one with a priority of | |
| 41 | * 500. | |
| 42 | * | |
| 43 | * @return the execution priority | |
| 44 | */ | |
| 45 | int getPriority(); | |
| 46 | ||
| 47 | /** | |
| 48 | * Transform the passed XDOM and modifies it. | |
| 49 | * | |
| 50 | * @param dom the AST representing the content in Blocks | |
| 51 | * @param syntax the Syntax of the content | |
| 52 | * @throws TransformationException if the transformation fails for any reason | |
| 53 | * @deprecated since 2.4M1 use {@link #transform(Block, TransformationContext)} instead | |
| 54 | */ | |
| 55 | @Deprecated | |
| 56 | void transform(XDOM dom, Syntax syntax) throws TransformationException; | |
| 57 | ||
| 58 | /** | |
| 59 | * Transform the passed XDOM and modifies it. | |
| 60 | * | |
| 61 | * @param block the block to transform (can be an {@link XDOM}) | |
| 62 | * @param context the context of the transformation process (syntax, transformation id, etc) | |
| 63 | * @throws TransformationException if the transformation fails for any reason | |
| 64 | * @since 2.4M1 | |
| 65 | */ | |
| 66 | void transform(Block block, TransformationContext context) throws TransformationException; | |
| 67 | } |