Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
完善readme说明。
  • Loading branch information
taoszu committed Nov 8, 2018
1 parent dc3f653 commit b23bfdc
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configurer
通过注解编译时生成关系的配置绑定,无需手动配置
通过注解在编译时自动生成工厂与生产者关系的配置绑定


## Get Start
Expand All @@ -24,7 +24,7 @@

```gradle
dependencies {
classpath "com.taoszu.configurer:plugin:1.0.2"
classpath "com.taoszu.configurer:plugin:1.1.1"
}
```

Expand All @@ -35,17 +35,31 @@
```

## Use

1. 定义基础接口类
```java
public interface BaseProgramer {
void doProgram();
}
```

1. 在类增加注解Wokrer


```java
@Worker(key = "taoszu", module = "Worker")
Class Worker {
@Worker(key = "android", module = "IT", baseClass = BaseProgramer.class )
Class AndroidProgramer implements BaseProgramer {
@Override
public void doProgram() {
Log.e("Programer", "我是安卓程序🐒")
}
}
```

2. 调用 FactoryHub.load() 初始化

3. 获取Worker的工厂
```java
BaseFactory workerFactory = FactoryHub.getFactoryInstance(module)
ITFactory itFactory = (ITFactory) FactoryHub.getFactoryInstance("IT");
BaseProgramer androidProgramer = itFactory.getWorker("android");
androidProgramer.doProgram()
```

0 comments on commit b23bfdc

Please sign in to comment.