Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
TemplateContent | 33 | 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.template; | |
21 | ||
22 | import java.lang.reflect.Type; | |
23 | ||
24 | import org.xwiki.model.reference.DocumentReference; | |
25 | import org.xwiki.rendering.syntax.Syntax; | |
26 | ||
27 | /** | |
28 | * The content of a template. | |
29 | * | |
30 | * @version $Id: 5633921dd5613a7fb067287a912e4547718daf45 $ | |
31 | * @since 7.0M1 | |
32 | */ | |
33 | public interface TemplateContent | |
34 | { | |
35 | /** | |
36 | * @return the source of the template | |
37 | */ | |
38 | String getContent(); | |
39 | ||
40 | /** | |
41 | * @return the syntax of the content | |
42 | */ | |
43 | Syntax getSourceSyntax(); | |
44 | ||
45 | /** | |
46 | * @return the syntax so set in the {@link org.xwiki.rendering.block.RawBlock}, note taken into account if a source | |
47 | * syntax is provided | |
48 | */ | |
49 | Syntax getRawSyntax(); | |
50 | ||
51 | /** | |
52 | * Return custom property with the provided name and converted (if needed) to the passed type. | |
53 | * | |
54 | * @param <T> the type of the value to return | |
55 | * @param name the name of the property | |
56 | * @param type the type of the property | |
57 | * @return the property value in the provided type or null if none could be found | |
58 | */ | |
59 | <T> T getProperty(String name, Type type); | |
60 | ||
61 | /** | |
62 | * Return custom property with the provided name and converted (if needed) to the passed default value type. If the | |
63 | * property does not exist the default value is returned. | |
64 | * | |
65 | * @param <T> the type of the value to return | |
66 | * @param name the name of the property | |
67 | * @param def the default value | |
68 | * @return the property value in the provided default value type or the provided default value if none could be | |
69 | * found | |
70 | */ | |
71 | <T> T getProperty(String name, T def); | |
72 | ||
73 | /** | |
74 | * @return the author of the template | |
75 | */ | |
76 | DocumentReference getAuthorReference(); | |
77 | } |