1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.monitoring.reporting.web.handler.api; 18 19 import java.util.Collections; 20 import java.util.Map; 21 22 public class Template { 23 private final String template; 24 private final Map<String, ?> userParams; 25 private final boolean html; 26 27 public Template(final String template) { 28 this(template, Collections.<String, Object>emptyMap()); 29 } 30 31 public Template(final String template, final Map<String, ?> userParams) { 32 this(template, userParams, true); 33 } 34 35 /** 36 * @param template template path, if isHtml is true it is relative to /templates otherwise it is absolute. 37 * @param userParams variables used by the template 38 * @param isHtml should the template be rendered with the site them or not (= is it a page fragment). 39 */ 40 public Template(final String template, final Map<String, ?> userParams, final boolean isHtml) { 41 this.template = template; 42 this.userParams = userParams; 43 this.html = isHtml; 44 } 45 46 public String getTemplate() { 47 return template; 48 } 49 50 public Map<String, ?> getUserParams() { 51 return userParams; 52 } 53 54 public boolean isHtml() { 55 return html; 56 } 57 }