Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DirectTemplateMapper |
|
| 1.0;1 |
1 | package org.apache.turbine.services.template.mapper; | |
2 | ||
3 | ||
4 | /* | |
5 | * Licensed to the Apache Software Foundation (ASF) under one | |
6 | * or more contributor license agreements. See the NOTICE file | |
7 | * distributed with this work for additional information | |
8 | * regarding copyright ownership. The ASF licenses this file | |
9 | * to you under the Apache License, Version 2.0 (the | |
10 | * "License"); you may not use this file except in compliance | |
11 | * with the License. You may obtain a copy of the License at | |
12 | * | |
13 | * http://www.apache.org/licenses/LICENSE-2.0 | |
14 | * | |
15 | * Unless required by applicable law or agreed to in writing, | |
16 | * software distributed under the License is distributed on an | |
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
18 | * KIND, either express or implied. See the License for the | |
19 | * specific language governing permissions and limitations | |
20 | * under the License. | |
21 | */ | |
22 | ||
23 | ||
24 | import org.apache.commons.lang.StringUtils; | |
25 | import org.apache.turbine.services.template.TemplateService; | |
26 | ||
27 | /** | |
28 | * The most primitive templating mapper. It is used for the navigation template | |
29 | * objects. It never caches and simply returns what is given to it but keeps | |
30 | * the template extension. | |
31 | * | |
32 | * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> | |
33 | * @version $Id: DirectTemplateMapper.java 1078552 2011-03-06 19:58:46Z tv $ | |
34 | */ | |
35 | public class DirectTemplateMapper | |
36 | extends BaseTemplateMapper | |
37 | implements Mapper | |
38 | { | |
39 | /** | |
40 | * Default C'tor. If you use this C'tor, you must use | |
41 | * the bean setter to set the various properties needed for | |
42 | * this mapper before first usage. | |
43 | */ | |
44 | public DirectTemplateMapper() | |
45 | { | |
46 | 39 | super(); |
47 | 39 | } |
48 | ||
49 | /** | |
50 | * Replace all "," with ".", but keep the extension. | |
51 | * | |
52 | * about,directions,Driving.vm --> about/directions/Driving.vm | |
53 | * | |
54 | * @param template The template name. | |
55 | * @return A class name for the given template. | |
56 | */ | |
57 | @Override | |
58 | public String doMapping(String template) | |
59 | { | |
60 | 0 | String [] components |
61 | = StringUtils.split(template, String.valueOf(TemplateService.TEMPLATE_PARTS_SEPARATOR)); | |
62 | ||
63 | 0 | return StringUtils.join(components, String.valueOf(separator)); |
64 | } | |
65 | } |