程序包 org.xmeta
接口 ThingManager
- 所有已知实现类:
AbstractThingManager
,ClassThingManager
,FileThingManager
,JarThingManager
,JdbcThingManager
,RedisThingManager
,TransientThingManager
public interface ThingManager
模型管理者是对模型的二级分类,一个模型管理者一般具体提供了如何按照某种格式保存和读取模型,模型管理者包含
目录和模型。
- 作者:
- zyx
-
方法概要
修饰符和类型 方法 说明 void
addThingManagerListener(ThingManagerListener listener)
添加模型管理者事件。void
clearCache()
清空缓存。boolean
createCategory(String categoryName)
创建新的目录。URL
findResource(String name)
查找资源。Category
getCategory(String name)
通过指定的目录名称获取目录。List<Category>
getCategorys()
返回模型管理者定义的根目录列表。ThingClassLoader
getClassLoader()
返回模型管理器的类装载器。String
getClassPath()
获取模型管理器所依赖的类库的路径。String
getName()
获得模型管理者的名称。Properties
getProperties()
获取模型管理器的配置。InputStream
getResourceAsStream(String name)
获取资源当作输入流,如果没有返回null。File
getRootDir()
返回项目所在的根目录。Thing
getThing(String thingName)
通过模型的名称取得模型。List<ThingIndex>
getThingIndexs(String categoryName)
返回指定目录下的模型索引列表。List<ThingIndex>
getThingIndexs(String categoryName, String descriptorPath)
根据描述者获取指定目录下的模型索引列表。List<Thing>
getThings(String categoryName)
取得指定目录下的模型列表。List<Thing>
getThings(String categoryName, String descriptorPath)
根据模型描述者取得指定目录下的模型列表。void
init(Properties properties)
初始化模型管理器。boolean
isSaveable()
模型是否是可以保存的,如果不能保存,那么即使模型在内存中改变了,也不能同步到存储上。Iterator<Thing>
iterator(String categoryName, boolean includeChildCategory)
指定目录遍历该目录下的模型。Iterator<Thing>
iterator(String categoryName, String descriptorPath, boolean includeChildCategory)
指定模型的描述者遍历指定目录下的模型。void
refresh()
刷新模型管理者。void
refresh(String categoryName, boolean includeChildCategory)
刷新指定目录。boolean
remove()
删除此模型管理者,在此方法里实现清除此模型管理者的相关内容。boolean
remove(Thing thing)
从模型管理者中移除一个模型。boolean
removeCategory(String categoryName)
删除一个目录。boolean
removeThingManagerListener(ThingManagerListener listener)
删除模型管理者的监听事件。boolean
save(Thing athing)
保存一个模型。void
setName(String name)
设置模型管理器的名称。void
setRootDir(File root)
设置项目的所在根目录。
-
方法详细资料
-
addThingManagerListener
添加模型管理者事件。- 参数:
listener
- 模型管理者的事件
-
clearCache
void clearCache()清空缓存。 -
createCategory
创建新的目录。- 参数:
categoryName
- 目录名称- 返回:
- 已创建或已存在的目录
-
getCategory
通过指定的目录名称获取目录。- 参数:
name
- 目录的名称- 返回:
- 目录,如果不存在返回null
-
getCategorys
返回模型管理者定义的根目录列表。- 返回:
- 模型管理者的所有目录
-
getName
String getName()获得模型管理者的名称。- 返回:
- 模型管理者的名称
-
setName
设置模型管理器的名称。- 参数:
name
- 模型管理器的名称
-
getThing
通过模型的名称取得模型。 比方法一般是World调用的,应用中取模型请通过World,World负责缓存。- 参数:
thingName
- 模型的名称,此名称为全名(包含目录)- 返回:
- 模型
-
getThingIndexs
返回指定目录下的模型索引列表。- 参数:
categoryName
- 目录名称- 返回:
- 目录索引列表
-
getThingIndexs
根据描述者获取指定目录下的模型索引列表。- 参数:
categoryName
- 目录名称descriptorPath
- 描述者路径- 返回:
- 目录索引列表
-
getThings
取得指定目录下的模型列表。- 参数:
categoryName
- 目录名称- 返回:
- 模型列表
-
getThings
根据模型描述者取得指定目录下的模型列表。- 参数:
categoryName
- 目录名称descriptorPath
- 模型描述者的路径- 返回:
- 模型列表
-
iterator
指定目录遍历该目录下的模型。- 参数:
categoryName
- 目录名称includeChildCategory
- 是否包含子目录- 返回:
- 模型遍历器
-
iterator
指定模型的描述者遍历指定目录下的模型。- 参数:
categoryName
- 目录名称descriptorPath
- 描述者的路径includeChildCategory
- 是否包含子目录- 返回:
- 模型遍历器
-
refresh
void refresh()刷新模型管理者。 -
refresh
刷新指定目录。- 参数:
categoryName
- 目录includeChildCategory
- 是否包含子目录
-
remove
boolean remove()删除此模型管理者,在此方法里实现清除此模型管理者的相关内容。- 返回:
- 是否成功
-
remove
从模型管理者中移除一个模型。- 参数:
thing
- 要移除的模型- 返回:
- 已经被移除的模型,如果没有则返回null
-
removeCategory
删除一个目录。- 参数:
categoryName
- 目录名称- 返回:
- 是否删除成功
-
removeThingManagerListener
删除模型管理者的监听事件。- 参数:
listener
- 模型管理者监听事件- 返回:
- 是否成功
-
save
保存一个模型。- 参数:
athing
- 要保存的模型- 返回:
- 如果保存成功那么返回该模型的根父模型,否则返回null
-
isSaveable
boolean isSaveable()模型是否是可以保存的,如果不能保存,那么即使模型在内存中改变了,也不能同步到存储上。- 返回:
-
getClassLoader
ThingClassLoader getClassLoader()返回模型管理器的类装载器。- 返回:
- 类装载器
-
getClassPath
String getClassPath()获取模型管理器所依赖的类库的路径。- 返回:
- 类路径
-
getResourceAsStream
获取资源当作输入流,如果没有返回null。- 参数:
name
- 资源名- 返回:
- 资源输入流
-
findResource
查找资源。- 参数:
name
- 资源名- 返回:
- 资源URL
-
init
初始化模型管理器。- 参数:
properties
- 参数
-
getProperties
Properties getProperties()获取模型管理器的配置。- 返回:
-
setRootDir
设置项目的所在根目录。- 参数:
root
-
-
getRootDir
File getRootDir()返回项目所在的根目录。- 返回:
-