1/*2 * $Id: TemplateSuite.java 1044707 2010-12-11 20:35:57Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.autotag.model;
2223import java.util.Collection;
24import java.util.LinkedHashMap;
25import java.util.Map;
2627/**28 * It represents a suite of template classes.29 *30 * @version $Rev: 1044707 $ $Date: 2010-12-11 21:35:57 +0100 (Sat, 11 Dec 2010) $31 */32publicclassTemplateSuite {
3334/**35 * The name of the suite.36 */37private String name;
3839/**40 * The documentation of this suite.41 */42private String documentation;
4344/**45 * The map of template classes.46 */47private Map<String, TemplateClass> templateClasses;
4849/**50 * Constructor.51 *52 * @param name The name of the suite.53 * @param documentation The documentation.54 */55publicTemplateSuite(String name, String documentation) {
56this(name, documentation, null);
57 }
5859/**60 * Constructor.61 *62 * @param name The name of the suite.63 * @param documentation The documentation.64 * @param classes The template classes.65 */66publicTemplateSuite(String name, String documentation,
67 Iterable<? extends TemplateClass> classes) {
68this.name = name;
69this.documentation = documentation;
70 templateClasses = new LinkedHashMap<String, TemplateClass>();
71if (classes != null) {
72for (TemplateClass templateClass : classes) {
73 templateClasses.put(templateClass.getName(), templateClass);
74 }
75 }
76 }
7778/**79 * Returns the template suite name.80 *81 * @return The name.82 */83public String getName() {
84return name;
85 }
8687/**88 * Returns the documentation.89 *90 * @return The documentation.91 */92public String getDocumentation() {
93return documentation;
94 }
9596/**97 * Adds a new template class.98 *99 * @param clazz The template class.100 */101publicvoid addTemplateClass(TemplateClass clazz) {
102 templateClasses.put(clazz.getName(), clazz);
103 }
104105/**106 * Returns the template classes.107 *108 * @return The template classes.109 */110public Collection<TemplateClass> getTemplateClasses() {
111return templateClasses.values();
112 }
113114/**115 * Returns a template class given its name.116 *117 * @param name The name of the class.118 * @return The template class instance.119 */120publicTemplateClass getTemplateClassByName(String name) {
121return templateClasses.get(name);
122 }
123124 @Override
125public String toString() {
126return"TemplateSuite [name=" + name + ", documentation="127 + documentation + ", templateClasses=" + templateClasses + "]";
128 }
129 }