| 接口 | 说明 |
|---|---|
| Loadable |
可加载的接口
实现接口中的加载方法,以获得成为 tuz 插件的资格
Loadable interface
You can obtain the power of being a loader of tuz by implementing this interface
|
| Tuzable |
核心接口,但是没有任何作用
Core interface, but it is useless
|
| 类 | 说明 |
|---|---|
| Tuz |
整个项目的核心类
The core of the whole project
Example 1:
加载资源文件
API: load(Loadable resource) throws IOException
test 是命名空间,后面一个是资源加载器
"test.properties" 文件中有一个属性:number=16
Tuz.load(new ClasspathPropertiesLoader("test.properties", "test"));
当然,你也可以不指定命名空间,内部会自动生成一个命名空间
不过,为了性能和正确性,还是建议您使用自定义的命名空间
当你不指定命名空间时,就会使用文件名作为命名空间
Tuz.load(new ClasspathPropertiesLoader("test2.properties"));
或者,您也可以使用另外一个加载器去加载文件系统中的资源文件
Tuz.load(new FileSystemPropertiesLoader("Z:/test.properties", "test"));
下面就是激动人心的时刻了!
|
| TuzConfig |
全局配置
所有设置都可以通过这个类去设置,tuz 中会从这个配置类中获取配置信息
Global config
This class includes all settings, and tuz will fetch setting from it
我们先以 cn.com.fishin.tuz.demo.TuzSimpleDemo2 作为切入点
先看原本的例子:
//Tuz.load(new ClasspathPropertiesLoader("test.properties"));
//xxxService service = DiPlugin.useInstance(xxxService.class);
//service.say("Hello, Tuz!")
|
Copyright © 2019. All Rights Reserved.