类 StringTemplateResourceLoader

java.lang.Object
org.beetl.core.resource.StringTemplateResourceLoader
所有已实现的接口:
Closeable, Serializable, AutoCloseable, ResourceLoader<String>

public class StringTemplateResourceLoader extends Object implements ResourceLoader<String>
字符串模板加载器
作者:
xiandafu
另请参阅:
  • 构造器详细资料

    • StringTemplateResourceLoader

      public StringTemplateResourceLoader()
  • 方法详细资料

    • getResource

      public Resource getResource(String template)
      返回一个template作为模板内容的模板
      指定者:
      getResource 在接口中 ResourceLoader<String>
      参数:
      template - 根据 key 可以查找到对应的资源
      返回:
      key 所对应的资源
    • close

      public void close()
      从接口复制的说明: ResourceLoader
      关闭 ResourceLoader,通常是 GroupTemplate 关闭的时候也关闭对应的 ResourceLoader
      指定者:
      close 在接口中 AutoCloseable
      指定者:
      close 在接口中 Closeable
      指定者:
      close 在接口中 ResourceLoader<String>
    • isModified

      public boolean isModified(Resource key)
      从接口复制的说明: ResourceLoader
      检测模板是否更改,每次渲染模板前,都需要调用此方法,所以此方法不能占用太多时间,否则会影响渲染功能
      指定者:
      isModified 在接口中 ResourceLoader<String>
      参数:
      key - 根据 key 可以查找到对应的资源
      返回:
      true 表示已更改,false 表示未更改
    • init

      public void init(GroupTemplate gt)
      从接口复制的说明: ResourceLoader
      初始化操作
      指定者:
      init 在接口中 ResourceLoader<String>
    • exist

      public boolean exist(String key)
      从接口复制的说明: ResourceLoader
      返回是否存在 key 所对应的资源
      指定者:
      exist 在接口中 ResourceLoader<String>
      参数:
      key - 根据 key 可以查找到对应的资源
      返回:
      true 表示存在,false 表示不存在
    • getResourceId

      public String getResourceId(Resource resource, String id)
      从接口复制的说明: ResourceLoader
      用于 include,layout 等根据相对路径计算资源实际的位置
      指定者:
      getResourceId 在接口中 ResourceLoader<String>
      参数:
      resource - 当前资源
      id - 目标资源所对应的键
      返回:
      计算出来的目标资源的位置
    • getInfo

      public String getInfo()
      从接口复制的说明: ResourceLoader
      获取资源加载器的信息,用于获取不到资源的时候输出提示信息
      指定者:
      getInfo 在接口中 ResourceLoader<String>
      返回:
      资源加载器的信息