public interface ResourceLoader<T> extends Closeable, Serializable
ClasspathResource,
类路径资源加载器,
StringTemplateResource,
字符串模板资源加载器,
FileResource,
文件资源加载器,
web应用资源加载器,
Matcher,
AllowAllMatcher,
StartsWithMatcher,
混合形式的资源加载器,
映射形式的资源加载器| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
关闭 ResourceLoader,通常是 GroupTemplate 关闭的时候也关闭对应的 ResourceLoader
|
boolean |
exist(T key)
返回是否存在 所对应的资源
|
String |
getInfo()
获取资源加载器的信息,用于获取不到资源的时候输出提示信息
|
Resource |
getResource(T key)
根据key获取Resource
|
T |
getResourceId(Resource resource,
T key)
用于 include,layout 等根据相对路径计算资源实际的位置
|
void |
init(GroupTemplate gt)
初始化操作
|
boolean |
isModified(Resource key)
检测模板是否更改,每次渲染模板前,都需要调用此方法,所以此方法不能占用太多时间,否则会影响渲染功能
|
boolean isModified(Resource key)
key - 根据 key 可以查找到对应的资源boolean exist(T key)
key - 根据 key 可以查找到对应的资源void close()
close 在接口中 AutoCloseableclose 在接口中 Closeablevoid init(GroupTemplate gt)
T getResourceId(Resource resource, T key)
resource - 当前资源key - 目标资源所对应的键String getInfo()
Copyright © 2022. All rights reserved.