All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jknack.handlebars.io.TemplateLoader Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
/**
 * Copyright (c) 2012-2015 Edgar Espina
 *
 * This file is part of Handlebars.java.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.jknack.handlebars.io;

import java.io.IOException;
import java.nio.charset.Charset;

/**
 *  

* Strategy interface for loading resources from class path, file system, etc. *

*

Templates prefix and suffix

*

* A TemplateLoader provides two important properties: *

*
    *
  • prefix: useful for setting a default prefix where templates are stored.
  • *
  • suffix: useful for setting a default suffix or file extension for your templates. Default is: * '.hbs'
  • *
* * @author edgar.espina * @since 0.1.0 * * @deprecated com.github.jknack.handlebars.io package is deprecated and marked for removal in subsequent releases which will involve removal of the handlebars dependency in AEM. */ @Deprecated(since = "2024-07-10") public interface TemplateLoader { /** * The default view prefix. */ String DEFAULT_PREFIX = "/"; /** * The default view suffix. */ String DEFAULT_SUFFIX = ".hbs"; /** * Get a template source from location. * * @param location The location of the template source. Required. * @return A new template source. * @throws IOException If the template's source can't be resolved. */ TemplateSource sourceAt(String location) throws IOException; /** * Resolve a relative location to an absolute location. * * @param location The candidate location. * @return Resolve the uri to an absolute location. */ String resolve(String location); /** * @return The prefix that gets prepended to view names when building a URI. */ String getPrefix(); /** * @return The suffix that gets appended to view names when building a URI. */ String getSuffix(); /** * Set the prefix that gets prepended to view names when building a URI. * * @param prefix The prefix that gets prepended to view names when building a * URI. */ void setPrefix(String prefix); /** * Set the suffix that gets appended to view names when building a URI. * * @param suffix The suffix that gets appended to view names when building a URI. */ void setSuffix(String suffix); /** * Set the default charset. * * @param charset Charset. */ void setCharset(Charset charset); /** * @return Charset. */ Charset getCharset(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy