Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WikiComponentMethodExecutor | 37 | 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.component.wiki.internal; | |
21 | ||
22 | import java.lang.reflect.Method; | |
23 | import java.util.Map; | |
24 | ||
25 | import org.xwiki.component.annotation.Role; | |
26 | import org.xwiki.model.reference.DocumentReference; | |
27 | import org.xwiki.rendering.block.XDOM; | |
28 | import org.xwiki.rendering.syntax.Syntax; | |
29 | ||
30 | /** | |
31 | * Execute a {@link XDOM} tree and returns a result matching the return value of a given {@link Method}. | |
32 | * | |
33 | * @version $Id: bd4aeaf481763fd77d76db0021bbb984f5ed53cd $ | |
34 | * @since 4.3M2 | |
35 | */ | |
36 | @Role | |
37 | public interface WikiComponentMethodExecutor | |
38 | { | |
39 | /** | |
40 | * The key under which inputs are put in the method context. | |
41 | */ | |
42 | String INPUT_KEY = "input"; | |
43 | ||
44 | /** | |
45 | * The key under which the output is stored in the method context. | |
46 | */ | |
47 | String OUTPUT_KEY = "output"; | |
48 | ||
49 | /** | |
50 | * Execute a {@link XDOM} and returns a value retrieved from the XDOM, retrieved from the | |
51 | * {@link org.xwiki.component.wiki.internal.WikiMethodOutputHandler} set in the method context under the OUTPUT_KEY | |
52 | * key, or from the rendered content itself. In this last case the rendered content is transformed in order to match | |
53 | * the return type of the passed Method. | |
54 | * | |
55 | * @param method The method to match the return value | |
56 | * @param args The arguments passed to the method | |
57 | * @param componentDocumentReference The reference to the component Document | |
58 | * @param xdom The XDOM mimicking the method | |
59 | * @param syntax The syntax of the XDOM | |
60 | * @param methodContext A map of key/value pairs to put in the context before executing the XDOM | |
61 | * @return A value matching the return type of the passed method | |
62 | */ | |
63 | Object execute(Method method, Object[] args, DocumentReference componentDocumentReference, XDOM xdom, | |
64 | Syntax syntax, Map<String, Object> methodContext); | |
65 | } |